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

My onTouch part script that is supposed to burn you is not working?

A script that is SUPPOSED to burn your legs if you touch the part.

How do I fix this error? No matter how many times I look at it, I personally don't see any errors.

part = script.Parent
f = Instance.new("Fire")

part.Touched:Connect(function(player)
	if player:FindFirstChild("Fire")~= nil then
	f.Parent = player
	end
	end)

4 comments

0

Is the part anchored?

0

I tried the script both anchored and unanchored. Still doesn't work.

0

It sets the baseplate on fire

0

Oh. I forgot to add the humanoid thingy. But it still doesn't work. I even anchored it and moved the part a little up so it's mid air and not touching anything.

1 answer

✓ Accepted answer

You can do something like that.

part = script.Parent
f = Instance.new("Fire")

part.Touched:Connect(function(part)
	local plr = game.Players:GetPlayerFromCharacter(part.Parent)
    if plr and not part:FindFirstChildOfClass("Fire") then
    f.Parent = part
    end
end)


8 comments

0

If its supposed to burn players only this should work.

0

Can you explain it to me? Because I know there's a simple way of doing it. It's my first time seeing a different script but does the same thing. I'm still a beginner so pls explain ;-;

0

Its the same as your script except it checks if it was touched by a player. The "part" is the limb that touched the part and its parent is your character.

0

What does GetPlayerFromCharacter do? Also what's the difference between FindFirstChildOfClass and FindFirstChild?

0

You can do alternative and check if parts parent(character) has a humanoid in it. part = script.Parent part.Touched:Connect(function(part) local f = Instance.new("Fire") local hum = part.Parent:FindFirstChild("Humanoid") if hum and not part:FindFirstChildOfClass("Fire") then f.Parent = part end end)

0

The difference between FindFirstChildOfClass and FindFirstChild is that FindFirstChildOfClass finds by the classname aka "Fire" in your case despite its original name. So if you for example have the fire named "thingy" it will still find it because its class is still fire.

0

GetPlayerFromCharacter finds a player by its character.

0

GetPlayerFromCharacter is kind of vague.. What's the use of it?

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