For some reason, the host and the contestant get teleported to the Audience Spawn most of the time, and I tried commenting out the Audience Spawn so you don't teleport but it doesn't work but sometimes, on occasion, they get teleported to the right spawn. What is going on?
game.ReplicatedStorage.ChangeTeam.OnServerEvent:Connect(function(plr,teamColor,Host,Contestant) print(teamColor) print("Hi") if teamColor.Name == "New Yeller" then Players = HostTeam:GetPlayers() if #Players == 0 then print("Current Host!") plr.TeamColor = teamColor wait(0.2) print("Host spawn is") print(HostSpawn.CFrame) print("Host spawn print ended") plr:LoadCharacter(Vector3.new(HostSpawn.CFrame + Vector3.new(0,10,0))) Players = HostTeam:GetPlayers() wait(0.2) print("Player position is") print(plr.Character.HumanoidRootPart.CFrame) print("Player print ended") print("Team " .. HostTeam.Name .. " has " .. #Players .. " players") end elseif teamColor.Name == "Really blue" then Players = ContestantTeam:GetPlayers() if #Players == 0 then print("Current Contestant!") plr.TeamColor = teamColor print("Contestant Spawn Position is") print(ContestantSpawn.CFrame) print("Contestant Spawn print ended") plr:LoadCharacter(Vector3.new(ContestantSpawn.CFrame + Vector3.new(0,10,0))) print("Player position is") print(plr.Character.HumanoidRootPart.CFrame) print("Player print ended") Players = ContestantTeam:GetPlayers() print("Team " .. ContestantTeam.Name .. " has " .. #Players .. " players") end elseif teamColor.Name == "Lime green" then print("Audience") plr.TeamColor = teamColor wait(0.2) local AudienceChildren = AudienceSpawns:GetChildren() local ChosenSpawn = AudienceChildren[math.random(1,#AudienceChildren)] print(ChosenSpawn) -- plr:LoadCharacter(Vector3.new(ChosenSpawn.CFrame + Vector3.new(0,10,0))) end end)
Here's the output, with the contestant.
Contestant Spawn Position is -319.949066, 3.49999905, 52.492691, 1, 0, 0, 0, 1, 0, 0, 0, 1 Contestant Spawn print ended Player position is 105.655556, 7.16043901, -98.5189438, 1, 0, 0, 0, 1, 0, 0, 0, 1 Player print ended
Here's the output, with the host.
Host spawn is -336.759064, 2.5, 20.2926903, 1, 0, 0, 0, 1, 0, 0, 0, 1 Host spawn print ended Player position is 127.674049, 7.14484882, 133.19339, 1, 0, 0, 0, 1, 0, 0, 0, 1 Player print ended
If you need any more script, just let me know.
To change the position of a certain character, you have to set the position of the HumanoidRootPart.
player.Character.HumanoidRootPart.Position = game.Workspace.Spawn.Position + Vector3.new(0,4,0)
I hope this helps!