Hi, I've been trying to make players claim separate spawns so that when they respawn / join the game they spawn there and the camera goes to their player. However, the spawning part of the script doesn't work. Can you check the script out and see what's wrong with it?
--//Claim Spawn - PlayerAdded
players.PlayerAdded:connect(function(plr)
for i = 1, #spawns do
if spawns[i].Name == "Spawn" then
repeat wait(0.1) until
game.Workspace:FindFirstChild(plr.Name)
game.Workspace:WaitForChild(plr.Name).HumanoidRootPart.CFrame = CFrame.new(spawns[i].Position) + Vector3.new(0,3,0)
game.Workspace:FindFirstChild(plr.Name).Humanoid.WalkSpeed = 0
spawns[i].Name = plr.Name
return
end
end
--//Respawn
plr.CharacterAdded:connect(function(char)
char:WaitForChild("Humanoid").Died:connect(function()
repeat wait(0.1) until
char.Humanoid.Health > 0
local plrspawn = spawns:FindFirstChild(plr.Name)
char.HumanoidRootPart.CFrame = CFrame.new(plrspawn.Position) + Vector3.new(0,3,0)
end)
end)
end)
Thanks in advance!
