How to do banana peel disappear after touched

So I did a tool that is a banana peel as you can imagine it makes players fall when touched, but I want it to disappear after touched (the banana that is on the ground)

Could someone write a script to do it?

local bananaPeel = ... --Path to your banana peel.

bananaPeel.Touched:Connect(function(basePart) --This function will trigger when any part of the player touches the banana peel.
	local character = basePart.Parent --Get the player's character from their character part.
	--bla.. bla.. bla.. -> Make the player fall however you want, can add anything here besides that too.
	
	bananaPeel:Destroy() --1st Option: Deletes the banana peel object from the game.
	
	bananaPeel.Transparency = 0 --2nd Option: Makes the banana peel invisible, but still exists in the game.
	bananaPeel.CanTouch = false --2nd Option Extra: Prevents the banana peel from being touched again.
end)
  • You can use the first option if you want to remove the bananaPeel from the game completely whe you’re done

  • You can use the second option if you want the bananaPeel to still exits in the game, but be invisible and untouchable. Making it untouchable will prevent the bananaPeel.Touched event from firing, so basically the function won’t work.

I included two options to just teach more functionalities, you probably should use :Destroy in this case if you are not going to use the banana for anything else after making it disappear.

1 Like

Thank you so much! It worked exactly like I needed, I used the Destroy option. :+1:

1 Like

Also could you help me with my other topic?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.