Force Sit script not working

I have made a Force Sit script, so that when I run !fsit, it will lock all players so they can not jump anymore (when they are seated). But, when I run the command again after i runned it 1 time, it does not unlock the player and give them their jumppower back.

Can anyone help me with this? This is the script that I currently have:

local requiredrank = 253

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(message)
		if player:GetRankInGroup(10558052) >= requiredrank and message == "!fsit" then
			for _, p in ipairs(game.Players:GetPlayers()) do
				local humanoid = p.Character and p.Character:FindFirstChild("Humanoid")
				if humanoid then
					humanoid.UseJumpPower = true
					humanoid.JumpPower = 0
				end
			end
			print("Force sit has been enabled, jumping is now disabled.")
		end
	end)
end)

So if I understand you correctly this code is working, but you would like it to work for a toggle, is this correct? @Clonnygamestyu

Yes, that’s correct.

Okay, the code doesn’t have a toggle, have you tried implementing one? Or making a command that does the opposite?

I created an command, what is the default jumppower of an player? 15, right?

Default jumppower of a Roblox player is 50. Default jump height is 7.2.

Thank you for the help, i created an command that does the opposite and it worked. I will mark your message as the solution.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.