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)
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.
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")
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")