Hi there, I am creating a Jerry can in Roblox Studio. I am trying to add a feature where you can pour the fuel in the Jerry can, as inspired from Neighborhood War (https://www.roblox.com/games/2039118386/Neighborhood-war-ALPHA-Read-Description)
When you click with the tool, particles come out of the can. This works fine. But, I also want parts to come out of the Jerry can. To achieve this, I am trying to clone a part in the Workspace and position it near the Jerry can when it is enabled. It is not working and there is no error message in the output.
Script:
while true do -- Loop if script.Parent.Particle.ParticleEmitter.Enabled == true then --Checks whether particles are enabled local clone = game.Workspace:FindFirstChild("GasolineDrop"):Clone() --Clones part local pos = script.Parent.Particle.Position clone.Position = Vector3.new(pos.X, pos.Y + 1, pos.Z) --Positions part end -- Concludes 'if' statement wait(0.25) -- Interval between each drop of fuel end --Concludes loop
Thankyou for any support.
One obvious omission is that the clone is not getting parented to anything. You need to set clone.Parent to something in the Workspace (or game.Workspace itself). When you Clone() an instance, the Parent property of the original instance is not copied, the clone always has Parent of nil and you need to explicitly set it.
The other thing that could be a problem is if "Particle" is an Attachment rather than a Part. If so, you want to set the Position of your clone to Particle.WorldPosition, not Particle.Position, because the latter is a part-relative offset.
If this is not the case, maybe show us what the structure is so we can better assist.