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

Having issue with this velocity humanoid sit?

Asked by
TechModel 118
3 years ago

How can I make it so the humanoid only sits when it exceeds a minimum velocity, but not when it touches it. Isn't it supposed to sit when it meets the velocity from the if statement?

script.Parent.Touched:Connect(function(touch)
    if touch.Parent:FindFirstChild("Humanoid") then
        if script.Hit.Value == false then
            script.Hit.Value = true
            local c = (10/12) * (60/88)
            local s =math.floor( c * script.Parent.Velocity.magnitude)
            local humanoid = touch.Parent:FindFirstChild("Humanoid")
            humanoid.Health = humanoid.Health - s * .3
            touch.Parent.Humanoid.Sit = true
            script.Parent.Hit:Play()
    wait(5)
    script.Hit.Value = false
    end
    end
end)

Answer this question