Hello.
So I have this starship I made and I want to clone it into the player when they join, and weld it to them, so they are in the starship.
I have this code:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
wait(5)
print(player.Name .. " joined the game!")
char = player.Character
shipClone = script.Parent:Clone()
shipClone.Parent = char
shipClone.Anchored = true
shipClone.Position = char:WaitForChild("HumanoidRootPart").Position
char:WaitForChild("HumanoidRootPart").Position = shipClone.Seat.Position
shipClone.WeldToPlayer.Part0 = char:WaitForChild("LowerTorso")
shipClone.WeldToPlayer.Part1 = shipClone
end)
For some reason, whenever it happens the player is teleported to a new location, with only the parent part, everything else way off in the distance, and I am stuck in the air.
The error is probably very obvious, so sorry, I only got a couple hours of sleep last night. If you can figure out why it is doing this, please tell me.
Oh, and I am new to scripting, so there's that.
Props to you if you can help me out,
-ProqrammedGreen

1 comment
Thanks, got me onto the right track. Have some reputation points!