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

Why does this script not work?

Asked by
JJ_B 250 Moderation Voter
8 years ago

I made this script as a simple lift, but it randomly stops moving halfway through until the third time around, where it works fully. Here is the script:

script.Parent.Touched:connect(function(plr)
    if plr.Parent ~= nil then
    local h = plr.Parent:findFirstChild("Humanoid")
        if h ~= nil then
            h.Parent.Torso.Anchored = true
            for i = 1, 90 do
            h.Parent.Torso.CFrame = h.Parent.Torso.CFrame + Vector3.new(0,0.3,0)
            wait(0.000001)
            end
            wait(0.5)
            h.Parent.Torso.Anchored = false
        end
    end
end)

Does anyone know why?

Answer this question