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

Is there a way/script that makes it so you can only jump in certain parts of your game?

Asked by 5 years ago

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.

2 answers

Log in to vote
0
Answered by
waifuSZN 123
5 years ago

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

0
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. waifuSZN 123 — 5y
Ad
Log in to vote
0
Answered by
kag_e 12
5 years ago

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)
0
Why did you put an event inside of an if statement? Horrible practice. User#19524 175 — 5y

Answer this question