-
What do I want to achieve?
I want player who touch fire then will spread fires through the body. like if fire touch arm then will spread to whole body
Example: fire touch part from house then will spread to end.
-
What is the issue?
wont to spread fire through the body I don’t know why. -
What solutions have I tried so far?
I searched through topics/videos about fire spread but non of these which is for body parts. because of most time they only use on objects(parts like house etc). even I tried these on body part but wont work.
Here a code:
local firePart = script.Parent
local canTouch = true
local function onTouch(otherPart)
local hum = otherPart.Parent:FindFirstChild("Humanoid")
if hum and canTouch then
canTouch = false
local fire = Instance.new("Fire", otherPart)
fire.Name = "Fire"
spawn(function()
while fire and fire.Parent and hum and hum.Health > 0 do
hum:TakeDamage(1)
wait(1)
end
end)
wait(1)
canTouch = true
end
end
firePart.Touched:Connect(onTouch)
local Debounce = false
script.Parent.Touched:Connect(function(hit)
local bodyParts = hit.Parent:GetDescendants()
if hit:IsA("bodyParts") then
if not Debounce then
Debounce = true
local fire = Instance.new("Fire")
local Fire = script.Parent.FireScript:Clone()
fire.Parent = hit
wait(0.5)
Debounce = false
end
end
end)
(Reminder, I only a beginner scripter. I used some script from topics and video. so there tons of error or bad script.)