Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a On-Clicked Part?

Hello, Like I said in my previous questions, I am building something. I just want to know how to make an on-Clicked Part, If you do answer. Thank you, If you sneezed "Bless You".

1 comment

0

There you go so please upvote and accept answer please.

2 answers

Ok well it would be like

function onClicked(playerWhoClicked)
    script.Parent.BrickColor = BrickColor.Random()
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

1 comment

0

good for answering, but you should explain how it was used, otherwise he wont be able to rly learn how to use it in the future

To make an onClicked part, you would need two things, one, click detector is inserted into the part that you want to click.

Second, if you want to click sonething, it needs a function.

For example,

function onClicked()

("Now type anything you want the function to execute)

game.Workspace.Part.Transparency = 0.6

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
-This would be calling the function, so it can activate.

-Whatever you put between the lines of the function, is what the script will execute.

2 comments

0

... come on I just said that :/

0

He explained it though. Upvoted

This discussion is preserved as it was. New answers, comments, and votes are closed.