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

Help with Anti-Jump script?

Asked by 10 years ago


function noHelmet(chr) local s = script.NoHelmet:clone() s.Disabled = false s.Parent = chr end function checkHelmets() local p = game.Players:GetPlayers() for i=1,#p do local c = p[i].Character if (c ~= nil) then local helmet = c:findFirstChild("Space Hat") if (helmet == nil and c:findFirstChild("NoHelmet") == nil) then noHelmet(c) end end end end function makeLowGrav(Head) print("NoJump", Head) local b = Instance.new("BodyForce") b.Name = "NoJump" b.force = Vector3.new(0,-20000,0) --adds a new body force. this will stop you from going up. try to go up, it will push you back down again! b.Parent = Head end function onPlayerRespawn(property, player) if property == "Character" and player.Character ~= nil then makeLowGrav(player.Character.Head) end end function onPlayerEntered(newPlayer) while true do if newPlayer.Character ~= nil then break end wait(5) end newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end ) makeLowGrav(newPlayer.Character.Head) end game.Players.ChildAdded:connect(onPlayerEntered) while(true) do wait(3) checkHelmets() end

It still lets the player jump.

Could anyone fix it so you cannot jump at all?

1 answer

Log in to vote
0
Answered by 10 years ago

Try using this script for it instead. Using velocity can cause complications.

repeat wait() until game.Players.LocalPlayer.Character
local Humanoid=game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
Humanoid.Changed:connect(function()
Humanoid.Jump=false
end)

Ad

Answer this question