Whenever someone joins, im trying to teleport them to their base but it doesn’t work on the first try for some reason. Anyone know whats wrong?
local function TeleportToBase(Char:Model)
Plr.CharacterAppearanceLoaded:Wait()
task.wait(.2)
local RootPart:BasePart = Char:WaitForChild('HumanoidRootPart')
local Platform:BasePart = Plr.Values.PlotOwned.Value.Platform
local Pos = Platform.Position + (Platform.CFrame.LookVector * 50)
RootPart.CFrame = CFrame.new(Pos + Vector3.new(0,5,0))
end
Plr.CharacterAdded:Connect(TeleportToBase)
CharacterAdded doesn’t fire just when the player loaded
this is the solution
local function TeleportToBase(Char:Model)
Plr.CharacterAppearanceLoaded:Wait()
task.wait(.2)
local RootPart:BasePart = Char:WaitForChild('HumanoidRootPart')
local Platform:BasePart = Plr.Values.PlotOwned.Value.Platform
local Pos = Platform.Position + (Platform.CFrame.LookVector * 50)
RootPart.CFrame = CFrame.new(Pos + Vector3.new(0,5,0))
end
Plr.CharacterAdded:Connect(TeleportToBase)
TeleportToBase(Plr.Character) -- you can add a delay
I don’t see a problem with your script, but I think if you delete the SpawnLocation and replace it with this simpler script it might work
local function TeleportToBase(Char:Model)
wait()
local Platform:BasePart = Plr.Values.PlotOwned.Value.Platform
local Pos = Platform.Position + (Platform.CFrame.LookVector * 50)
Char:MoveTo(CFrame.new(Pos + Vector3.new(0,5,0)).Position)
end
@BirdieI90 I didn’t mean to reply to you sorry lol i meant to the OP’s script