I'm trying to make it so the player teleports once they've spawned it, however it isn't working. It says player isn't a valid member of workspace.
local Players = game:GetService("Players")
function onPlayerAdded(player)
print(player.Name .. " has entered the game")
player.CharacterAdded:connect(function(character)
local humanoid = character:FindFirstChild("Humanoid")
humanoid.WalkSpeed = 0
workspace:findFirstChild("Player")
game.Workspace.Player.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(0, 50, 0))
end)
end
Players.PlayerAdded:connect(onPlayerAdded)
for _,player in pairs(Players:GetPlayers()) do
onPlayerAdded(player)
end

1 comment
Line 8 doesn't make sense. you're trying to find something called "Player". You probably just want to use Character.HumanoidRootPart.CFrame on line 9.