digital speedometer script

  • hello guys I hope I did not have a wrong section in which case I apologize.I also apologize for my language I use a translatorI'm making an ETR500 for high speed Italian but unfortunately after having model and cabin with all the working parts I had to stop because I do not understand anything about the script and language lua, so I hope someone can help me.I have to create a digital speedometer but without having to create an object for every single number, but something that makes them repeat from 0 to 9 without weighing the project, turning on the network I found several scripts already made but none that could be efficient for me, so I have adapted this that I will show you below, I hope you can help me thanks


    gSpeedo = (math.floor(Call("*:GetControlValue", "SpeedometerMPH", 0)))


    _, _, gHundreds, gTens, gUnits = string.find(gSpeedo, "(%d)(%d)(%d)")



    if Call("*:GetControlValue", "SPUnits", 0) == 0 then
    Call("*:SetControlValue", "SPUnits", 0, tonumber(gUnits))
    Call("*:SetControlValue", "SPTens", 0, (0))
    Call("*:SetControlValue", "SPHundreds", 0, (0))


    elseif Call("*:GetControlValue", "SPTens", 0) == 0 then
    Call("*:SetControlValue", "SPUnits", 0, tonumber(gUnits))
    Call("*:SetControlValue", "SPTens", 0, tonumber(gTens))
    Call("*:SetControlValue", "SPHundreds", 0, (0))



    elseif Call("*:GetControlValue", "SPHundreds", 0) == 0 then
    Call("*:SetControlValue", "SPUnits", 0, tonumber(gUnits))
    Call("*:SetControlValue", "SPTens", 0, tonumber(gTens))
    Call("*:SetControlValue", "SPHundreds", 0, tonumber(gHundreds))
    end



    Externer Inhalt youtu.be
    Inhalte von externen Seiten werden ohne Ihre Zustimmung nicht automatisch geladen und angezeigt.
    Durch die Aktivierung der externen Inhalte erklären Sie sich damit einverstanden, dass personenbezogene Daten an Drittplattformen übermittelt werden. Mehr Informationen dazu haben wir in unserer Datenschutzerklärung zur Verfügung gestellt.