Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help with Anti-Jump script?



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

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.