Players not locked into their seats when respawning

I want all members of the students team to be locked into their seats. This works fine when they join in, but when they respawn, they are able to exit their seat. I have created this local script, parented to StarterCharacterScripts, to try and fix this, but it is not working.

local character:Model = script.Parent
local humanoid:Humanoid = character.Humanoid

local player:Player = game.Players.LocalPlayer

player.CharacterAdded:Connect(function()
	
	humanoid.UseJumpPower = true
	
	if player.Team == game.Teams.Students then
		
		humanoid.JumpPower = 0
	else
		humanoid.JumpPower = 50
	end
end)
2 Likes

is the script for the initial spawn in server sided?

my thought is maybe because your setting jump power localy the jump signal may still be sent to the server and since toy are changing the power client side it doesnt replicate to the server.

if thats not the case i would just firce them back into their seat every few frames if possible.

Hope this helps :slightly_smiling_face:

1 Like

Try getting the humanoid on a server script like this:
game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")

See if that helps.

1 Like

It’s due to the humanoid variable. Try getting the humanoid again after the characteradded function

1 Like

The initial script that is supposed to lock players into their seats is server sided.
Here is the part that retrieves the humanoid


			local studentCharacter = player.Character or player.CharacterAdded:Wait()
			--wait for student's character

			local studentHumanoid:Humanoid = studentCharacter:WaitForChild("Humanoid")
1 Like

ok truy doing what you did with the local scrip t but on the server. this should fix your issue

3 Likes

Finally works! Thanks so much!

1 Like