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

Why can't a parent be something that a part touches?

local banana = game.Workspace.banana
function addFire (touch)
	local fire = Instance.new("Fire")
	fire.Size = 5
	fire.Parent = banana.Touched
end
banana.Touched:Connect(addFire)

I'm new too scripting so I decided to learn about events. I started exploring on my own and wondered why this code won't work.

1 comment

0

fire.Parent = touch

1 answer

✓ Accepted answer

I changed your script a little bit!

Here it is:

local banana = game.Workspace.banana
function addFire (touch)
    local fire = Instance.new("Fire")
    fire.Size = 5
    fire.Parent = touch
end
banana.Touched:Connect(addFire)

Hope It Help!

4 comments

0

Thanks it worked.

0

But I have another question: How does the part know if a player touches it or a brick touches it?

0

You can use if hit.Parent:FindFirstChild("Humanoid") for all entities, or game.Players:FindFirstChild(hit.Parent.Name) or something like that

0

I was following one of Alvin Blox's tutorials and I ended up using the GetPlayerFromCharacter function like this: if game.Players:GetPlayerFromCharacter(touch.Parent) then

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