game.Players.PlayerAdded:Connect(function(plr)
print("Hmm")
plr.CharacterAdded:Connect(function(char)
print("nice")
char.HumanoidRootPart.CFrame = game.Workspace.Seat.CFrame -- idk if your seat is a part or a actual seat
char.HumanoidRootPart.Anchored = true
local Clone = game.ReplicatedStorage.Flashlight:Clone()
Clone.Parent = plr.Backpack
char.Humanoid:EquipTool(Clone)
end)
end)
CharacterAdded fires so early the character first gets teleported to that location, and then actually gets teleported to the spawn, therefore making it seem like the teleport never happened.
The only way to fix this is to wait for a few moments before attempting teleportation, or wait until the character is no longer at 0,0,0. It’s a hacky and bad solution, but it’s the only possible way to do this as far as I’m aware.
In my experience, CharacterAdded doesn’t necessarily mean that the character is parented to workspace - you should include something to check that it is before calling :MoveTo, :SetPrimaryPartCFrame, or whatever else you’re using.
game:GetService("Players").PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local CharacterInWorkspace
CharacterInWorkspace = Character.Changed:Connect(function()
if Character.Parent == workspace then
print("Character added into workspace - you can now call :MoveTo or :SetPrimaryPartCFrame.")
CharacterInWorkspace:Disconnect()
end
end)
end)
end)
Instead of using a repeat until loop, it’s better to do…
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
...
Also, your repeat until loop will yield at until plr.CharacterAdded:Wait() and plr.Character.Humanoid and plr.Character.HumanoidRootPart since, :Wait() will cause your current thread to yield until the event .CharacterAdded has fired, so, it’s pretty useless either way.