I am trying to make a rocket where when you press F the rocket attaches to your back and begins to emit fire and then fly’s of directly up into the sky.
The issue is that everything works except the last part mainly due to I dont know which Body[name] to use. I have used BodyPosition and BodyVelocity and neither did anything.
Here’s the code:
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local replicatedStorage = game:GetService("ReplicatedStorage")
local rocket = replicatedStorage.Rocket
local attachRE = replicatedStorage.AttachRE
attachRE.OnServerEvent:Connect(function(player)
print("Reached server!")
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character.HumanoidRootPart
humanoidRootPart.Anchored = true
local rocketClone = rocket:Clone()
rocketClone.Parent = humanoidRootPart
rocketClone.CFrame = humanoidRootPart.CFrame * CFrame.new(0, 0.5, 0.5)
rocketClone.Anchored = false
local weld = Instance.new("WeldConstraint")
weld.Parent = rocketClone
weld.Part0 = humanoidRootPart
weld.Part1 = rocketClone
local particles = rocketClone:WaitForChild("Particles").ParticleEmitter
particles.Enabled = true
wait(3)
particles.Speed = NumberRange.new(1, 3)
print("Launching...")
local bodyPosition = rocket:WaitForChild("BodyPosition")
bodyPosition.Position = Vector3.new(0, 100, 0)
print("Launched!")
end)
If you made this system, then shouldn’t you also know exactly what body mover you’re using and how you should access it if you want to change it? Sounds like you need to review your code a bit, or do some debugging to find out what the exact problem is. For example, maybe you never created a body mover in the rocket and are missing that and so WaitForChild is infinitely waiting for something that will never exist.
That’s not what the thread is asking, and not what I’m suggesting either. The thread is asking for help because their WaitForChild is infinitely yielding; I suggested this is the case because they don’t have a body mover in the first place. As the creator of this system, they should also know why exactly their code isn’t working and which name they should be giving to WaitForChild if the body mover does in fact exist.
OP’s problem seems to come from a lack of code review.
Um no, that is not what this thread is asking. I am asking what mover to use. The waitforchild isnt yielding anything. And I did make this code, why are you saying I didn’t.
There has been a bit of a misunderstanding on my behalf because I misread your thread, so I do apologise. I was not properly aware that you were asking which of them you should use and conversely thought you posted the code because of an error in your script.
However, to make it clear: I did not imply you did not make this system. This tied into my misconception that if you made the system, you should also know what body mover existed in your assembly. I was not aware that you didn’t have one to begin with and were asking what you should use.
The main point of confusing for me the wording and sharing code when the code isn’t broken, rather you wanted recommendations on what body mover to use.