Categories > Coding > Lua >
[TUT] Button click script tutorial
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.
Replied
you are a big skid
Cancel
Post
| Discord (Updated): apppon#8358 | C++ Enthusiast |Â
| Discord (Updated): apppon#8358 | C++ Enthusiast |Â
Replied
@MyUserIsTaken add my new account real quick. iS-e-x#7430, remove -, my account got hacked.
Cancel
Post
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
Cancel
Post
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
Cancel
Post
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)
Cancel
Post
JustMarie#0709
Â
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
Cancel
Post
i own synapse x
biggest idiot in town
discord: nakiri#4485
Replied
@MyUserIsTaken Nobody cares about your opinions, and no I am not a skid. People call me like that because they THINK that I copy and paste scripts or something, but I just tried to look at axon. Even looking at it is being a skid? Like literally. You're being rude because you have a bad life in your house, don't you?
Cancel
Post
arent u sad when somebody doesn't reply to ur dms?
yeah i got that boi.
Replied
didnt understand fully still giving errors in vistual studio please give more info
Cancel
Post
Exploit i have : Synapse X , Sir hurt .Â
Hubs i use , Dark hub , Alpha XÂ
Guis I made : Tower of hell > https://pastebin.com/5gV0H08w
Replied
you are a skid and many people agree now get the f out you fcking 7 year old
Cancel
Post
| Discord (Updated): apppon#8358 | C++ Enthusiast |Â
Official Xenfall download:
https://xenfall.weebly.com/download.html
*pls dont hate im not good in making exploits smh*
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post