I am trying to make a sliding game and I don't want people to be able to jump down the slide to the end, so I need to disable jumping, but only in a certain area, using something like on touch. Please help as I am a noob at scripting and don't know what I'm doing.
✓ ANSWER ACCEPTED
Is there a way/script that makes it so you can only jump in certain parts of your game?
2 answers
✓ Accepted answer
Have an invisible part at the beginning and end of the slide.
When they pass through the first part, have a value set in the player set to false; when they pass through the second part, set this value to true.
Then just have a loop that prevents jumping while the value is false.
https://wiki.roblox.com/index.php?title=API:Class/BasePart/Touched
https://wiki.roblox.com/index.php?title=API:Class/Humanoid/Jump
make a Part where you want them to not be able to jump
local noJumpPart = game.Workspace.noJumpPart -- change this to the noJumpPart
noJumpPart.Touched:Connect(function(hit)
local plrHumanoid = hit.Parent:FindFirstChild("Humanoid")
if plrHumanoid ~=nil then
plrHumanoid.Changed:Connect(function()
plrHumanoid.Jump = false -- when the character dies they can jump again or just right up some other nifty code to do whatever you want
end)
end
end)
1 comment
0
Why did you put an event inside of an if statement? Horrible practice.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Or, better yet, when they pass through the first part, set their jump to false, and when pass thru the end part, set it to true again.