Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a gear light bricks on fire?

Asked by 8 years ago

I've been working on this game and I got parts in Workspace to light other bricks on fire, but the script doesn't seem to work when it goes in a tool (a torch in this case). Any help available?


function lightOnFire(part) print("Going to light this part on fire:") print(part.Name) fire = Instance.new("Fire") fire.Parent = part end firePart = game.StarterPack.Torch.FirePart firePart.Touched:connect(lightOnFire)

(Sorry if the code isn't showing up right, I'm still figuring this site out :P)

0
For formatting: The ~~~ should be on their own line -- no text before after after them in that line.  BlueTaslem 18071 — 8y
0
Thanks! Tripidate 0 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Your script is using a part which is in StarterPack. When the player spawns, that tool will be cloned into the player's inventory, but the script will remain checking the part in StarterPack.

I'd recommend using a LocalScript inside the tool, and change "firePart" to:

local firePart = script.Parent.FirePart
Ad

Answer this question