Roblox is wack, can you help with his easy code

So I was normally coding and all of the sudden this simple script does NOT work, and I am like what the hell???

EVEN roblox uses the same scripts and it does not work so pls help

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		char:MoveTo(game.Workspace.Spawns.Cyan.Teleport.Position)
	end)
end)

it shows no absolute error

Now I tried using humanoidrootpart.position and cframe, thing did not work either.

It may depend on where you exactly put the script

It should be in ServerScriptService as a Server Script, and you could also implement sanity checks to make sure that you can truly move the Character using WaitForChild() to yield the code:

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
        local HRP = char:WaitForChild("HumanoidRootPart")
		HRP.CFrame = CFrame.new(workspace.Spawns.Cyan.Teleport.Position)
	end)
end)

You may need to wait for your character to load. Try adding a small wait() for testing purposes. I assume it’s either the part itself or your character that is taking a long time to load.

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        wait(3) -- Only for testing purposes
        Character:MoveTo(workspace.Spawns.Cyan.Teleport.Position)
    end)
end)
1 Like

Thanks apparently roblox is ew ew

Waiting for character to load should not be a problem seeing how CharacterAdded will only become active once the character has loaded. I have never had a problem where the character was unloaded at the point that CharacterAdded became active.

1 Like