So i'm starting to learn how to script right now, and I got the basic things down, like for example, if I type ~~~~~~~~~~~~~~~~~ Workspace.Part.Transparency=0.5 ~~~~~~~~~~~~~~~~~in the command bar, it makes the brick transparent. So I started experimenting with scripting a little bit more and made this scripted ..
function onTouch(Part) workspace.Part.Transparency=.5 wait(2) workspace.Part.Transparency=0 end Part.Touched:connect(onTouch)
but for some reason, it's not working. Does anyone know why this doesn't work?
In the connection line to the function you need to define the Parent
of Part
, otherwise the script won't know where to locate the object that is being manipulated.
function onTouch() workspace.Part.Transparency=.5 wait(2) workspace.Part.Transparency=0 end workspace.Part.Touched:connect(onTouch) -- Defined where the object can be found
Questions / comments? Feel free to message me and I'll answer them as soon as possible. If you are satisfied with the answer I provided, please upvote me. Thanks!