Cloning model into player glitching out, any help to fix it?
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:
01 | local Players = game:GetService( "Players" ) |
03 | Players.PlayerAdded:Connect( function (player) |
05 | print (player.Name .. " joined the game!" ) |
06 | char = player.Character |
08 | shipClone = script.Parent:Clone() |
09 | shipClone.Parent = char |
11 | shipClone.Anchored = true |
13 | shipClone.Position = char:WaitForChild( "HumanoidRootPart" ).Position |
14 | char:WaitForChild( "HumanoidRootPart" ).Position = shipClone.Seat.Position |
16 | shipClone.WeldToPlayer.Part 0 = char:WaitForChild( "LowerTorso" ) |
17 | shipClone.WeldToPlayer.Part 1 = shipClone |
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