Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does my animation get stuck at 66? It should move 1/5 closer every 30th of a second

Asked by
WVPII 5
7 years ago
game:GetService("RunService").RenderStepped:connect(function() -- Flashy animation
    if SelectedGun == 0 then 
        Selector.Visible = false
        return false
    end
    Selector.Visible = true
    local TargetSelectorPosition = SelectedGun == 1 and 0 or 70
    Selector.Position = UDim2.new(0, Selector.Position.X.Offset + ((TargetSelectorPosition - Selector.Position.X.Offset) / 5), 0, 15)
end)

!!?? It should move the selector one 5 of the way closer to it's target each time, but get's stuck at 66 when going from 0 - 70, but always hits 0.

Any ideas?

Answer this question