game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) script.Parent.Jetpack1:Clone().Parent = Character end) end)
I know that I need a CFrame after CharacterAdded, but I can't figure out where.
game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) local clone = script.Parent.Jetpack1:Clone(). cone.Parent = Character end) end)
You want to set the cframe before putting the object into workspace, it saves memory.
game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) Torso = Character:WaitForChild("Torso”) JP = script.Parent.Jetpack1:Clone() JP.CFrame = Torso.CFrame JP.Parent = Character end) end)
But there are still 2 problems with this script. 1. We are placing the jetpack at the same position as your torso, effectively putting it inside your character. 2. We are only setting the position once, so when you move the jetpack won't follow you. To fix this, we will offer offset the CFrame, and use a weld.
game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) local weld = Instance.new(”Weld”) local Torso = Character:WaitForChild("Torso”) local JP = script.Parent.Jetpack1:Clone() JP.CFrame = Torso.CFrame weld.Parent = Torso weld.Part0 = Torso weld.Part1 = JP.Handle --you might need to change handle for another part in the jetpack weld.C0 = CFrame.new(0, 0, 1) -- this will place it .5 studs behind your back, which should make it look like it's sitting on your back JP.Parent = Character end) end)