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

How can i make this code stop running if the humanoid is in the air?

Asked by 4 years ago
local player = script.Parent.Parent.Parent
local character = player.Character
    local humanoid = character.Humanoid

script.Parent.RemoteEvent.OnServerEvent:Connect(function()  

local Part = Instance.new("Part")
local animation = script.Parent.Parent.Animation
local animationtrack = humanoid:LoadAnimation(animation)
animationtrack:Play()
            humanoid.WalkSpeed = 0
            humanoid.JumpPower = 0
            Part.Material = ("Concrete")
            Part.Size = Vector3.new(9, 11, 1)
            Part.BrickColor = BrickColor.new("Brown")
            Part.Anchored = true
            Part.CanCollide = false
            Part.CFrame = character.Head.CFrame * CFrame.new(0, -10, -7)
            Part.Parent = game.Workspace
            local bv = Instance.new("BodyVelocity")
            bv.Parent = Part
            bv.MaxForce = Vector3.new(1e8, 1e8, 1e8)
            bv.Velocity = Vector3.new(0, 2, 0) * 9
            Part.Anchored = false
            wait(.55)
            humanoid.WalkSpeed = 16
            humanoid.JumpPower = 50
            Part.Anchored = true
            Part.CanCollide = true
            wait(2.5)
           for i = 0, 1, 0.04 do
        Part.Transparency = i
        wait()
    end
    game.Debris:AddItem(Part, .1)



    Part.Touched:Connect(function()
        Part.CanCollide = true
end)
end)






Answer this question