This script is either not picking up the change of the players team or the change of the BoolValue when the function is ran a second time. Why?
seat = script.Parent team = game:GetService("Teams").King rStorage = game:GetService("ReplicatedStorage") seat.Changed:Connect(function() wait() if seat.Occupant then local character = seat.Occupant.Parent local player = game.Players:GetPlayerFromCharacter(character) if player.Team ~= (team) and rStorage.BoolValue.Value == false then rStorage.BoolValue.Value = true player.Team = (team) player:LoadCharacter() rStorage.RemoteEvent1:FireAllClients() seat.Disabled = true wait(1) seat.Disabled = false elseif player.Team == (team.Parent.Blue) and rStorage.BoolValue.Value == true then rStorage.RemoteEvent2:FireAllClients() rStorage.RemoteEvent2:FireClient(player) elseif player.Team == (team) then else rStorage.RemoteEvent3:FireClient(player) seat.Disabled = true wait(1) seat.Disabled = false end else print("No occupant") end end)
I didn't change much and the original script worked, so in the future, like Gameplayer said see what prints and what doesn't to narrow down your problem.
-- Define all of your unchanging variables outside the scope local seat = script.Parent local ReplicatedStorage = game:GetService("ReplicatedStorage") local TeamService = game:GetService("Teams") local KingsTeam = TeamService:WaitForChild('King') local BlueTeam = TeamService:WaitForChild('Blue') local BoolValue = ReplicatedStorage:WaitForChild('BoolValue') local RemoteEvent1 = ReplicatedStorage:WaitForChild('RemoteEvent1') local RemoteEvent2 = ReplicatedStorage:WaitForChild('RemoteEvent2') local RemoteEvent3 = ReplicatedStorage:WaitForChild('RemoteEvent3') -- Changed event to only look for a specific change seat:GetPropertyChangedSignal('Occupant'):Connect(function() local Player = game.Players:GetPlayerFromCharacter(seat.Occupant and seat.Occupant.Parent or nil) local Character = Player and Player.Character or false if Character then if ( Player.Team ~= KingsTeam ) and BoolValue.Value then BoolValue.Value = true Player.Team = KingsTeam Player:LoadCharacter() RemoteEvent1:FireAllClients() seat.Disabled = true wait(1) seat.Disabled = false elseif ( Player.Team == BlueTeam ) and BoolValue.Value then -- You can just disclude the player -- instead of firing the same event twice RemoteEvent2:FireAllClients(Player.Name) elseif Player.Team == KingsTeam then print ( "woo" ) else RemoteEvent3:FireClient(Player) seat.Disabled = true wait(1) seat.Disabled = false end else print("No occupant") end end)