I tried to make a script to when a player joins the game, it makes an array of all the different spawns, then teleports the player to one of the spawns randomly. But whenever someone joins the game, nothing happens. Sorry if this is crude, I'm somewhat new.
local s1 = script.Parent.Tpart1.Position local s2 = script.Parent.Tpart2.Position local s3 = script.Parent.Tpart3.Position local s4 = script.Parent.Tpart4.Position local plrs = game:GetService("Players") local spawnarray = {s1, s2, s3, s4} plrs.PlayerAdded:Connect(function(plr) plr.CharatcerAdded:Connect(function(char) wait(1) char.HumanoidRootPart.Position = (spawnarray[math.random(4)]) end) end)
I believe you have misspelt CharacterAdded
(you have spelt it CharatcerAdded
) here I have fixed the problem:
local s1 = script.Parent.Tpart1.Position local s2 = script.Parent.Tpart2.Position local s3 = script.Parent.Tpart3.Position local s4 = script.Parent.Tpart4.Position local plrs = game:GetService("Players") local spawnarray = {s1, s2, s3, s4} plrs.PlayerAdded:Connect(function(plr) plr.Character:Connect(function(char) wait(1) char.HumanoidRootPart.Position = (spawnarray[math.random(4)]) end) end)