Character Teleport on join not working

So, I want to teleport the player to an area above a spawn that made the player on that team. (Here’s the script for the telepart btw)

local PartSpawn = script.Parent

local Players = game:GetService("Players")

local player = Players.LocalPlayer

local character = player.Character

Players.PlayerAdded:Connect(function()

character.Position = PartSpawn.Position

end)

Here is the error it gave me:

And for some reason, although spawned on a different team spawn, it still displayed my name on the starter team’s team.

Thanks

local PartSpawn = script.Parent

local Players = game:GetService("Players")

local character = player.Character

Players.PlayerAdded:Connect(function(player)

player.CharacterAdded:Connect(function(character)

character.HumanoidRootPart.CFrame = PartSpawn.CFrame

end)

end)

Make a serverscript instead, put it on serverscriptservice.

1 Like

It didn’t work
here is the error

Workspace.PartSpawn.Script:5: attempt to index nil with ‘Character’

1 Like
local PartSpawn = script.Parent

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)

player.CharacterAdded:Connect(function(character)

character.HumanoidRootPart.CFrame = PartSpawn.CFrame

end)

end)

Sadly, it didn’t work :frowning_face:

I guess I’ll just make 1 spawn.

Oh wait I’m an idiot
I forgot to make the spawns on different teams! :rofl: