function onTouch(part) local r = script.Parent r.Transparency = .5 wait(1) r:remove(part) end script.Parent.Touched:connect(onTouch)
This script is currently working (sorta), The only problem is that I can't seem to make it so that the block only gets removed when a player touches it. I've tried a few things that result in breaking the script, so this is the version of the script that is halfway working.
Any help?
Make a condition based off whether the object that touched it is a player or not. Try this:
local players = game:GetService("Players") local r = script.Parent r.Touched:connect(function(part) local player = part and part.Parent and players:GetPlayerFromCharacter(part.Parent) if player then r.Transparency = 0.5 wait(1) r:Destroy() end end)