function SAM(p) p.Transparency = 1 if p.Transparency == 1 then p.Transparency = 0 else p.Transparency = 1 end end
script.Parent.Touched:connect(SAM) I wanna try to make the leg dissapear then reappear
You did not make your script edited to look like a script but I'll still try. First, anything that touches the part will change. You have no waits and I believe everything is happening, but too fast to notice. Try this:
function SAM(p) p.Transparency = 1 wait(1) if p.Transparency == 1 then p.Transparency = 0 end end script.Parent.Touched:connect(SAM)
Now, to make this not spam we use Debounce. One way to explain a Debounce is: A variable that will stop the script from being start again causing it to repeat. If you touch something, that will not count or be registered as one touch, it will be several. Here's the script with Debounce:
debounce = false -- This MUST be false or it will not allow anything to happen function SAM(p) if debounce == false then -- if it's true, nothing will happen, only if debounce = false debounce = true -- Now this script cannot repeat when touched p.Transparency = 1 wait(1) if p.Transparency == 1 then p.Transparency = 0 wait(1) -- Waits 1 second before debounce = false debounce = false -- Now debounce is false; touching it again will work end end end script.Parent.Touched:connect(SAM)
Both should work. You will have to edit if you want more then one leg changing transparency.