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

Why doesnt this fly tool work in game?

Asked by 8 years ago
plr = script.Parent.Parent.Parent

anim = script:WaitForChild("Animation")


script.Parent.Equipped:connect(function()
    local animTrack = plr.Character.Humanoid:LoadAnimation(anim)
    animTrack:Play()

    local bv = Instance.new("BodyPosition")
    bv.MaxForce = Vector3.new(10000, 10000, 10000)
    bv.Parent = plr.Character.Torso
    bv.Position = plr.Character.Torso.Position
    bv.P = 1000
    bv.D = 1250


    script.Parent.Activated:connect(function()
    local flying = true
    script.Parent.Deactivated:connect(function()
        flying = false
        bv.Position = plr.Character.Torso.Position
    end)
    plr.Character.Humanoid.Changed:connect(function()
        if flying == true then
            bv.Position = plr.Character.Humanoid.TargetPoint
        end
    end)


    end)
    script.Parent.Unequipped:connect(function()
        bv:Destroy()
        animTrack:Stop()
    end)

end)

I made this flying tool( this is the script inside it, its not a local script) Its fe Not sure why its not working, help would be great.

Answer this question