Hello I am trying to make a command where when a part is stepped on by the player, it disappears. I'm working on a tycoon game. My current code makes it so the brick disappears before I even touch it. Also I want to make it into a function as I will be using multiple parts and make it so the transparency changes to 1 when the player has an X amount of money and touches the part.
function ChangeTransparency(part, newTransparency)
part.Transparency = newTransparency
print "Worked"
end
workspace.ButtonTest.Touched:Connect (ChangeTransparency(game.Workspace.ButtonTest, 1))

1 comment
Errors: 1. You forgot to connect your code with an RBXScriptSignal of a player (hit.Parent). 2. Part isn't defined. 3. Line 6 has an invalid argument etc.