This is a script inside the StarterPack which makes a new instance , fire into the left arm when it's touched.Once it worked but if I spammed touching the fire was spamming too.Any sugestions?
la = c["Left Arm"] lc = la:GetChildren() function lo(Part) la.BrickColor = BrickColor.new("Really red") la.Transparency = 0.2 if la:FindFirstChild("Fire") == nil then a = Instance.new("Fire", la) a.Heat = 5 a.Size = 6 a.Color = Color3.new(236/255, 0/255, 0/255) a.SecondaryColor = Color3.new(139/255, 0/255, 0/255) end la.TouchEnded:connect(function() for i = 1,#lc do if lc[i].Name == "Fire" then lc[i]:remove() end end la.BrickColor = c["Body Colors"].TorsoColor la.Transparency = 0 end) end la.Touched:connect(lo)
You're only getting the children of the arm once, at the start of the script. You need to get them every time you loop through the children:
la.TouchEnded:connect(function() for _, v in ipairs(la:GetChildren()) do if v:IsA("Fire") then v:Destroy() end end la.BrickColor = c["Body Colors"].TorsoColor la.Transparency = 0 end
You could also program this more efficiently by simply toggling whether the fire is Enabled or not rather than removing and creating more each time.