Please understand I've only just started and can't find any help for this online. I'm essentially trying to make a campfire that you can click for it to turn on.
This is what I have tried: function lightFire(part) fire = Instance.new("Fire") fire.Parent = part end
Campfire = workspace.Campfire
Campfire.ClickDetector.MouseClick:connect (lightFire)
~~~~~~~ I'm assuming that the reason this doesn't work is due to me not specifying a location, although I can't find how to do that, any help?
The parameter that is passed through MouseClick is the Player object in Players, so you wouldn't know that something inserting a fire in there. To fix this, we can use the Character property and a thing in the player. For example, we can do
function lightFire(plr) if plr.Character then --is the player dead and the new character is about to be spawned? Instance.new('Fire', plr.Character.Head) --You should not use the second argument for Instance.new with a thing that has physics, as it will cause many physics calculations when setting the properties. end end
for the function
Hope this helps!