Forums > lua >

[TUT] Button click script tutorial


Posts: 20

Threads: 3

Joined: Nov, 2020

Reputation: 0

Posted

Hello, fellow forum searcher! You've provably got here, because you're looking for a script that does something, when a button is clicked. Aren't you? Before we start, basically, you need a variable so you don't have to use the full script as im doing that always. So, at the begging, you type:

 

local button = script.Parent

 

Alright. Now, as we got the variable, you need the script for the button script, right? That's simple, really simple right now. You just type:

 

button.MouseButton1Click:Connect(function()

        

end)

 

Well, as you can see, you have the button script already. Wait, there's still what we have to do in these scripts. We need to add something right there! Otherwise, there will be just a normal output from the script, and it will be just actually useless. So that's what you can type for an example:

 

print("Button clicked! Function triggered!")

 

That's all you should type in these scripts. If you want, you can just copy and paste the "source code" from the script and that's all that you need. I hope that I've helped you.

 

Full script:

 

local button = script.Parent

 

button.MouseButton1Click:Connect(function()

      print("Button clicked! Function triggered!")

end)

 

Thank you for reading! I hope I helped you with something that you need for your script, or something else, so basically you should accept me in that WRD community and you shouldn't call me somebody that is a "noob" or a "newbie."

arent u sad when somebody doesn't reply to ur dms?

yeah i got that boi.

MyUserIsTaken

apppon

Posts: 692

Threads: 29

Joined: Sep, 2020

Reputation: 5

Replied

you are a big skid 

| Normal shibe | Rep Goals : 12345678910, 11, 12, 13, 14, 15, 16 |  Discord: apppon#0001 |

MaximusExploit

Maximus

Posts: 570

Threads: 25

Joined: Aug, 2020

Reputation: 7

Replied

@MyUserIsTaken is he that guy with the axon skidder role

Rep Goals : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

 

Do NOT DM me for help.

MyUserIsTaken

apppon

Posts: 692

Threads: 29

Joined: Sep, 2020

Reputation: 5

Replied

@MaximusExploit

mhm and he asked me stupid questions

| Normal shibe | Rep Goals : 12345678910, 11, 12, 13, 14, 15, 16 |  Discord: apppon#0001 |

MaximusExploit

Maximus

Posts: 570

Threads: 25

Joined: Aug, 2020

Reputation: 7

Replied

@MyUserIsTaken add my new account real quick. iS-e-x#7430, remove -, my account got hacked.

Rep Goals : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

 

Do NOT DM me for help.

Nexus42

Mr. Pancake

Posts: 473

Threads: 39

Joined: Apr, 2020

Reputation: 1

Replied

Idk this seems a bit useless :/

 

If U actually said what it does instead of giving parts of the script saying to go to the next instruction it might be a bit more useful

 

Otherwise why not just leave the entire script there without splitting it into different sections with useless comments XD

Official Owner of: Raptor Technologies

Exploits Raptor™ Own: Glympse, Raptor Pro

Lua Scripter | C# & C++ Programmer

davidTube

dave

Posts: 1655

Threads: 65

Joined: Dec, 2018

Reputation: 16

Replied

very very very very very very basic, can just get all of this with a google search but good for starter game devs ig

FlamePlus OWNER  |  Thx Virt for the +Rep  |  UI & C# DEV, C++ BEGINNER  |

Exploits I have:  |  Syn X  |

|  Discord Server  |  My Discord  |  Download Flame+  |  OnlyFans  |

ThatPhoenix

Bad guy

Posts: 1661

Threads: 34

Joined: May, 2020

Reputation: -22

Replied

<@uid:634412>

There can only be one Phoenix >:(

Added

@PhoenixCheats

There can only be one Phoenix >:(

 

(fixed)

Phoenix#8419

 

Gooogle

Google Exploit Assistant

vip

Posts: 3756

Threads: 137

Joined: Aug, 2020

Reputation: 23

Replied

@ThatPhoenix 

hey post farm bad

Google Exploit Assistant
Synapse | Sirhurt | Discord |
Knows HTML
G
o
o
o
o
o
o
o
o
o
o
o

o
o
o
o
o
o
o
o
o
o
o
o
o
o
o

o
o
o
o
o
o
o
o
o
o
g
l
e

ThatPhoenix

Bad guy

Posts: 1661

Threads: 34

Joined: May, 2020

Reputation: -22

Replied

@Gooogle

says the person that likes to reply to me even if its a face ;-;

Phoenix#8419

 

Gooogle

Google Exploit Assistant

vip

Posts: 3756

Threads: 137

Joined: Aug, 2020

Reputation: 23

Replied

@ThatPhoenix

 

WTF 8 NOTIFICATIONS AAAAAAAA

Google Exploit Assistant
Synapse | Sirhurt | Discord |
Knows HTML
G
o
o
o
o
o
o
o
o
o
o
o

o
o
o
o
o
o
o
o
o
o
o
o
o
o
o

o
o
o
o
o
o
o
o
o
o
g
l
e

TaxiDriver08

grubhub

Posts: 545

Threads: 17

Joined: Dec, 2020

Reputation: 6

Replied

well i'd kinda disagree with this thread post..

its all well and good that you shown people how to do this but like jumping straight to something without actually working towards it (in other words people mess up and create inefficent code and spaghetti code because they don't really understand)

Autumn#0709

 

OpenGamerTips

(H3x0R)

Posts: 1433

Threads: 111

Joined: Feb, 2020

Reputation: 11

Replied

uh you ever think of

local function Click(...)
    
end

script.Parent.MouseButton1Down:Connect(Click)
 
feels like you went on yt and pasted this in l0l

| BaconDevs Founder | C# and Lua Developer |

| 3 years of experience in programming |

| My GitHub | Contact |

simple_x

Lumine

Posts: 420

Threads: 17

Joined: Sep, 2019

Reputation: 4

Replied

this thread is useless

it takes a newbie in scripting 5 minutes to search on youtube or roblox api to know how to do this

“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”

</> Rosery Team | C++ developer | Lua scripter

Roblox  |  GitHub  YouTube  ]