PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Player-on-Part Touch Detection – Lighting Parts on Fire: Code Sample 10

Player-on-Part Touch Detection – Lighting Parts on Fire: Code Sample 10

Oct 01 2018, 3:16 AM PST

function lightOnFire(part)
	print("Going to light this part on fire:")
	print(part.Name)
	
	fire = Instance.new("Fire")
	fire.Parent = part
end

firePart = game.Workspace.FirePart

firePart.Touched:Connect(lightOnFire)

function putOutFire(part)
	print("Got to put out the fire on:")
	print(part.Name)
	
	fire = part:FindFirstChild("Fire")
	if fire then
		fire:Destroy()
	end
end

waterPart = game.Workspace.WaterPart
waterPart.Touched:Connect(putOutFire)

firePart.Transparency = 1
waterPart.Transparency = 1