I can’t seem to get the HumanoidRootPart of the Player with my Script in ServerScriptService?
Please help.
Script:
-- // Copyright 2022, UnspeakableGames112, All rights reserved.
game.Players.PlayerAdded:Connect(function(plr)
local char = plr.Character
local tppart = workspace.Lobby:WaitForChild("LobbySpawn")
task.wait(1)
char.HumanoidRootPart.CFrame = tppart.CFrame
end)
Here are some pictures.
The Lobby.
And the script.
Carrotoplia
(Carrotopliani)
September 29, 2022, 2:00pm
#3
local char = plr.Character or plr.CharacterAddded:Wait()
try that
2 Likes
Oh my jeez, you people reply so quickly. I will try that.
Try this instead.
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
char:WaitForChild("HumanoidRootPart").CFrame = yourPart.CFrame
end)
end)
1 Like
Katrist
(Katrist)
September 29, 2022, 2:01pm
#6
Change your code to this:
--//Services
local Players = game:GetService("Players")
--//Variables
local tppart = workspace.Lobby:WaitForChild("LobbySpawn")
--//Functions
Players.PlayerAdded:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
task.wait(1)
character:PivotTo(tppart.CFrame)
end)
1 Like
Both works, thank you guys for helping me with this. Appreciate it.