Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I have made two scripts. One is a localscript, the other being a regular script. The regular script enables the GUI on a player's screen when the player sits in the seat. The localscript is what makes the GUI function. I've scripted the entire thing but only the regular script seems to function, The localscript does not seem to function as it is scripted to.
The GUI appears on the screen but when pressed it does nothing. What are the errors in the localscript that is not allowing the GUI to function as its scripted to?
First off, thanks for writing out a clear and concise question. Most of the questions under this tag are all over the place :. I would verify that you LocalScript instance is being properly initialized inside of the Player instance that is sitting down. Looking over your LocalScript 's code, I don't see any errors that would cause the GUI not to function if the LocalScript is being initialized properlywhich leads me to believe the LocalScript isn't even running.
If you are loading the LocalScript into the player on spawn so, putting it into the PlayerScripts folderthere's your problem. This would cause the GUI to not be set up properly, as it hasn't been inserted into the players PlayerGui instance yet, so the LocalScript won't be able to hook up the MouseButton1Click events or anything of that sort.
So, make sure that the LocalScript starts running once the player sits in the seat use the regular Script that displays the GUI to also move a copy of the LocalScript into the player.
If this doesn't work, check your output window for any blatant errors, and post em here. Learn more. Why isn't my localscript working? Ask Question.
Subscribe to RSS
Asked 3 years, 9 months ago. Active 3 years, 9 months ago. Viewed times. I am basically trying to script a GUI control panel that allows users to accelerate the train with a power lever in the GUI and a reverser Forward, Neutral, Reverse I have made two scripts. Active Oldest Votes. Patrick Bell Patrick Bell 3 3 silver badges 15 15 bronze badges. Thank you for the response! Unfortunately, when I copied the localscript and placed into the script, it did not work.
Hello Everyone I am wondering why this code gives me an error It's supposed to take some cash of all the players and then add 1 to an int value stage update its cost and change the speed value SpawnDelay so when he clicks on it again it knows what stage he is on but for some reason this does not work as the if statement shows up as incorrect please help:. After removing all the excess code statements, we can see that the code structure is, at the very least, missing three end keywords. Learn more.
Asked 3 years, 4 months ago. Active 3 years, 4 months ago. Viewed times. Text script. Players:GetPlayers do v. Value - workspace. Active Oldest Votes. Players:GetPlayers do -- missing end -- missing end. Oka Oka Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
The Overflow Blog. Featured on Meta. Feedback on Q2 Community Roadmap. Technical site integration observational experiment live on Stack Overflow. Question Close Updates: Phase 1. Dark Mode Beta - help us root out low-contrast and un-converted bits. Related 0. Hot Network Questions.
The only problem is that it will work once then not work at all. Let's walk through this, first it detects if it's false. No, sprinting is not false. Then if checks if it's true. It is!
So it sets it to false. Great so far, right? Well here's your problem.
When you try it again, sprinting is false. So the first if statement is run, and it sets it to true. Since it's now true, this runs, setting it to false.
It appears nothing happened. Your solution? Take out the end to the first if statement, and replace the second if to an elseif. This way once one statement evaluated to true, it won't evaluate the next. Your logic is not correct. As warspyking said, you have an issue with your conditionals. Fix this by adding an elseif statement instead. Learn more. Asked 4 years, 3 months ago. Active 4 years, 3 months ago.For some reason MouseButton1Click does not work for prints or others, I looked up this problem, did not find any fixes.
There can be several things going on but I would check the zIndex of the button your trying to execute that on, because it might be under a gui and it is not allowing it to be clicked. Sign Up Log in. New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Still have questions? Join our Discord server and get real time help. Join our Discord Server. Log in to vote. Why is MouseButton1Click Not working? Asked by LordPigMan 0. Mission1 mission1. MouseButton1Click:connect function print "Working" end Please help. Also I've checked the location already, location is fine. LordPigMan 0 — 4y. Answered by aquathorn I'd make sure mission is a button gui of some sort, I can't see any other errors. This code should work. JamesLWalker — 4y. Code did not work LordPigMan 0 — 4y.
View all comments 2 more. Is mission1 a textbutton or imagebutton? If not, then you need to change it to either of those. You say mission1 is a variable to a GUI? Like, what, an object value? If thats the case, you need to do mission1.I found the problem For some reason it refused to work in my textbutton, but when I deleted it and put in a new text button with the same script it worked perfectly. Sign Up Log in.
New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Still have questions? Join our Discord server and get real time help. Join our Discord Server. Log in to vote. OnClick function for GUI text button not working? Asked by Smunkey Answered by LightModed Answered by MaskedVoid For GUI's you do not use click detectors like you would in a part, instead you would use: script.
MouseButton1Down:connect onClicked This triggers when the left mouse button is pressed. Make sure the script is inside the button rather than the click detector when you fix it! Awesome, thank you! Smunkey 90 — 4y. Still not working. The entire "mousebutton1down" function seems to just not work. Where have you put the script? MaskedVoid 15 — 4y. View all comments 4 more. I just tried it and it worked fine, I put the script in the same place and everything. Wait, it doesn't need something like 'script.
ROBLOX TROLLING GUI EDIT
MouseButton1Click:connect onMouseClick ' type of deals on the bottom does it? Because the wiki mentions nothing of the sort Smunkey 90 — 4y. I noticed I had it way down at the bottom of the list of gui parts and not directly in the folder, my bad.
But I need it to work without creating new instances but I can't figure out how :l Smunkey 90 — 4y. Answer Edit.Public Pastes. Not a member of Pastebin yet? Sign Upit unlocks many cool features! Enjoy the Money". I did not make the scripts for Bens Icecream, kick from house and turn lights on and take no credit for them.
Position - Pos. Visible and not Working then. Position - HRP. CustomerTargets:GetChildren do. SpawnedCharacters:GetChildren do. Value:FindFirstChild 'Order' then.
Order:GetChildren do. ItemHolder:children do. Value then. Character or Player. Fantasy Close. Size18 Close. Fantasy IceCream. Size18 IceCream. SourceSans IceCreamHeader. Size18 IceCreamHeader.
Enjoy the Money" IceCreamHeader. Top StartIceCream. Fantasy StartIceCream. Size18 StartIceCream.This is the code that I have been trying to tinker with:. There's a syntax error on line 11, MouseButton1Click is not a method, it is an event. An easy fix is just to replace line 11 with: screen. MouseButton1Click:connect function player. Also, click only fires if the user presses mouse one and lets go of it while the cursor is in the bounds of the TextButton object.
If you just want it to fire upon the initial click which I recommenduse MouseButton1Down:connect. Sign Up Log in. New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always. Still have questions? Join our Discord server and get real time help.
Join our Discord Server. Log in to vote. Asked by marioblast This is the code that I have been trying to tinker with: wait 0.
MouseButton1Click :connect function player -- screen. Child is the "Play" button screen. Are there any errors, which lines? Also, try MouseButton1Down. Not sure if that'll make a difference.
Edit-- I think the problem is that you cannot do script. Child unless the object is named "Child". You have to use the actual name of the object. TheLuckyZ 24 — 3y. Is the name of the script.
Child Actually child? No, it is named "Frame" marioblast — 3y. Answered by TheEdgyDev MouseButton1Click:connect function player Also, click only fires if the user presses mouse one and lets go of it while the cursor is in the bounds of the TextButton object. Correct, adding on; you could also use a callback. JamesLWalker — 3y. It still doesn't work.
Nice try though Its syntax compiles perfectly; any error is from implementation. Make sure the actual directory the event is being attached to is the proper instance.