i just want it that if you touch the brick, the player becomes on fire with blue fire, without killing it.
local part = workspace.part
local touchlava = function(hitpart)
if hitpart.parent:findfirstchild("humanoid") then
if hitpart.parent.humanoid.health > 100 then
local partsgotten = hitpart.parent:getchildren()
for i, partgotten in pairs(partgotten) do
if partgotten:isa("basepart") then
local fire = instance.new("fire", partgotten)
fire.color = color3 new(128, 187, 219)
end
end
end
end
end
This has a lot of capitalization errors, I wouldn’t expect this code to work at all, considering some syntax errors and no connection to a touched event. Allow me to reconstruct your code:
local part = workspace:WaitForChild("Part") --Change to the actual part name inside Workspace
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Humanoid.Health > 0 then
for _, part in ipairs(hit.Parent:GetChildren()) do
if part:IsA("BasePart") and not part:FindFirstChild("Fire") then
local fire = Instance.new("Fire")
fire.Color = Color3.fromRGB(128, 187, 219)
fire.Parent = part
end
end
end
end)
Instead of using fire you could use a similar looking particle to achieve the fire effect without actually damaging the player.
2 Likes
By default, fire doesn’t actually damage the player…right?