I'm making a firefighter simulation game and I need the fire to damage you over time if you're on fire.
Here is the script that activates when you touch the fire:
--Made by KiddySquid debounce = false function touched(hit) local humanoid = hit.Parent:WaitForChild("Humanoid") --Look for the humanoid if humanoid and debounce == false then --Make sure the humanoid exists humanoid:TakeDamage(30) local fire = script.Parent.FireEffect:Clone() print("clone fire") fire.Parent = hit --Put the fire in the body part the fire hit print("set fire parent") local burnscript = script.Parent.FireScript:Clone() print("clone burnscript") burnscript.Parent = fire print("set parent") burnscript.Disabled = false print("disable") debounce = true --Prevent the script from running for another 2 seconds print("debounce true") wait(2) debounce = false --Allow it to run again print("Debounce false") end end script.Parent.Touched:connect(touched)
Every single print I put in works just fine. However in the FireScript, the main script is trying to clone:
--Made by KiddySquid character = script.Parent.Parent humanoid = character:WaitForChild("Humanoid") --Make sure the humanoid exists to prevent errors intensity = game.ServerStorage.RoundStats.FireIntensity.Value iteration = 1 repeat iteration = iteration + 1 print("iteration") wait(0.3) if humanoid then --If the humanoid exists make it take damage. This way, parts can still catch on fire print("if humanoid") humanoid:TakeDamage(6.5 * intensity) print("takedamage") end print ("end") until iteration == 30 print ("until iteration 30") script.Parent.Fire.Enabled = false --Disable the fire instead of deleting it right away so the particles can dissolve print("disable fire") wait(2) script.Parent:Destroy() print("destroy")
Absolutely nothing prints. It does clone to the character just fine, and it does enable the script just fine, but the script itself refuses to run.