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

How to make it so that you click a button and it responds to the click?

Asked by 4 years ago

Hello, I am a very new Roblox scripter and I would like to know how to do this. I've learnt basic things like variables, functions, and arithmetic. If you add the GUI button icon what do you do from there?

0
For parts you can use a ClickDetector, or for a screenGUI use a TextButton or an ImageButton. DinozCreates 1070 — 4y
0
Thank you! projectzrgosbrother 0 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Hello, I am also a new roblox lua scripter. Here is something you can start off doing if you want to mess with "Guis" that do something when a button is clicked. The lines of code you see below is just some simple lines of code i've learnt in a day or two.

01-- Made by Nitrolux200, Instructions below.
02-- In "StarterGui" add a "ScreenGui" and name it however you like.
03-- Insert an "ImageLabel" inside the "ScreenGui", put the image in the "ImageLabel" and make visible to false.
04-- Insert a "TextButton" and inside the "TextButton" add a "LocalScript" inside.
05-- Go in the local script and copy and paste the lines of code below if you want to.
06 
07local image = script.Parent.Parent.ImageLabel
08local button = script.Parent
09visible = false
10 
11script.Parent.MouseButton1Click:Connect(function()
12    if visible == false then
13        visible = true
14        image.Visible = true
15 
View all 40 lines...

P.S) if you want to accpet this answer as the "my question answered" since I gave you an example i'd be very appreciated :)

0
Thank you projectzrgosbrother 0 — 4y
Ad

Answer this question