So I’m trying to make when you join the game you will be teleported first to somewhere, but when I use this script I don’t have any errors, it’s simply just doesn’t work.
local player = game.Players.LocalPlayer
wait(5)
game.Players.PlayerAdded:connect(function(player)
player.Character:WaitForChild("HumanoidRootPart").CFrame = CFrame.new(game.Workspace.TP.CFrame)
end)
script is in serverscriptservice, meaning it’s a serverscript.
local players = game:GetService("Players")
local function playeradded(player)
end
for i,v in pairs(players:GetPlayers()) do
coroutine.wrap(playeradded)(v)
end
players.PlayerAdded:Connect(playeradded)
its because you are using CFrame.new on a value which is already CFrame try this:
local player = game.Players.LocalPlayer
wait(5)
game.Players.PlayerAdded:connect(function(player)
player.Character:WaitForChild("HumanoidRootPart").CFrame = game.Workspace.TP.CFrame
end)
You have to wait for the player.character’s appearence added. nil in the error refers to you script running before the player’s character is even added. I usggest using Player:CharacterAdded:Connect() and running your script inside of that.