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
You used Vector3.new and not CFrame.new. Maybe that's the issue?
I looked through your script, and I resolved your error.
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 character.HumanoidRootPart.CFrame = CFrame.new(0, 50, 0) --At the beggining, put "Character" instead of "workspace.Player". Also, consider using just CFrame then using Vector3. end) end Players.PlayerAdded:connect(onPlayerAdded) for _,player in pairs(Players:GetPlayers()) do onPlayerAdded(player) end
Hope this works!