Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I add fire into people when they touch a brick spawned with :Clone?

Hi, so I have been trying to burn people when they touch the part spawned by :Clone() but when I add Touched event to the cloned part the person who touches it doesn't burn. I have been trying many ways like adding functions in functions but it still does not work.

Here's my code:

local toclone = script.Parent:WaitForChild("Handle")
local RE = script.Parent:WaitForChild("Throw")
local DS = game:GetService("Debris")

local function newClone(plr)
	local newclone = toclone:Clone()
	newclone.Parent = workspace
	newclone.Name = "Molotov Cocktail"
	newclone.CanCollide = true
	newclone.Position = plr.Character.Head.Position + (plr.Character.Head.CFrame.lookVector * 4) + Vector3.new(0,3,-2)
	newclone.Velocity = plr.Character.Head.CFrame.lookVector * 40
	local addFire = Instance.new("Fire")
	addFire.Parent = newclone
	addFire.Enabled = true
	addFire.Heat = 9
	addFire.Size = 5
	DS:AddItem(newclone, 5)
end

RE.OnServerEvent:Connect(newClone)

1 answer

✓ Accepted answer

You are just adding a fire effect to the Molotov Cocktail, as the wiki states Unlike actual flames, the Fire object does not spread on its own. If you notice this behavior in your game, it is happening because of a Script. You have to manually add the effect the the player, and give him the damage yourself. Its just an visual effect.

5 comments

0

I know I am adding it for visuals to make it look realistic but I don't know how I can manually add it to the player, is there any possible ways to do that?

0

yes the player has char which exists out of parts just parent it to one of those

0

but when I try to make it touch the newclone variable is not defined as the newClone function has closed

0

What do you mean ?, you can add an .Touched in there for the molotov and check if its hits a player and then add the fire to that player ?

0

Thanks, I think my fire script is not working and I will rework on it

This discussion is preserved as it was. New answers, comments, and votes are closed.