Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Is this script correct?

Asked by 10 years ago
H = game.Workspace.Part

function OnTouch(Part)
wait(2)
H.Transparency = 1
wait(2)
H.Transparency = 0
end
  • I'm a newbie, I'm trying to experiment with functions.

2 answers

Log in to vote
1
Answered by 10 years ago
H = game.Workspace.Part
function onTouch(thing)--Thing is the thing that touched this part
wait(2)
H.Transparency = 1
wait(2)
H.Transparency = 0 -- Changing the transparency of H, which is the part in workspace.
end
script.Parent.Touched:connect(onTouch)--The most important part, the closing of the function. This calls the function when the script's parent is touched. Make sure that this script is inside of the object you want to be touched.
0
Thank you DeathBear :D bloonblaster2000 55 — 10y
Ad
Log in to vote
-1
Answered by 10 years ago
game.Workspace.Part

function OnTouch(Part)
wait(2)
game.Workspace.Part.Transparency = 1
wait(2)
game.Workspace.Part.Transparency = 0
end
0
All you did was take out H = ._. bloonblaster2000 55 — 10y

Answer this question