Hi!
I am the least experienced scripter in the history of scripters, and I am in need of help.
The thing I need is a brick which forces the player to sit, but prohibits them to jump.
This brick is to put at the start of a slide. I want the player to sit all the way through the slide down, so they can't simply jump and walk down.
A script I pulled out of the free models library (I'm sorry guys, if I could script myself, I would do it) already takes care of the sitting part:
enabled = true function onTouched(hit) if not enabled then return end enabled = false local h = hit.Parent:findFirstChild("Humanoid") if (h ~= nil) then h.Sit = true end enabled = true end script.Parent.Touched:connect(onTouched)
It is possible that only a single line of code is enough to make this work, but unfortunately I have yet to be successful.
The player should be allowed to jump again when the bottom is reached (or if they die).
I hope someone can help me! Thanks in advance.
Maybe try turning off the animation
--Turn off anim enabled = true function onTouched(hit) if not enabled then return end enabled = true local h = hit.Parent:findFirstChild("Humanoid") if (h ~= nil) then h.JumpPower = 0 -- DEFAULT IS 50 h.Sit = true h.Animation.Disabled = true --[[ wait(5) TAKE OFF (--[[ and ]] if you want to return to normal after a certain amount of time. h.Animation.Disabled = false h.JumpPower = 50 ]] end end
Maybe try this:
local shouldSit = true function onTouch(obj) local human = obj.Parent:FindFirstChild("Humanoid") --Find humanoid if human then --If there is a player touching while shouldSit do --If they should sit human.Sit = true --Keep them sitting wait() --Make sure the program doesn't crash end end end script.Parent.Touched:Connect(onTouch)
If this didn't work, let me know and I'll debug it.