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

Looking for a script that will close Roblox from clicking a button inside a GUI, Help?

Asked by 6 years ago

I have this GUI that has a Quit button on it, I couldn't find anyone having the script. I'm looking for a script that allows the GUI to close Roblox when you click it.

0
script.Parent.MouseButton1Click:Connect(function() game:Destroy() end) greatneil80 2647 — 6y
0
Didn't work. Tyserkhan004 22 — 6y
0
There is no way to make the GUI close the application of roblox, the maximum you can do is to kick the player. yHasteeD 1819 — 6y
0
Can you tell me how to do that? Tyserkhan004 22 — 6y
0
you can't.... Unless you just break in into the code of RobloxPlayerBeta.exe using Lua-- wait no, you can't. Only way is when you click the button, you kick the player. (see answers below, they'll show you how) mudathir2007 157 — 6y

2 answers

Log in to vote
1
Answered by
SCP774 191
6 years ago

There is no way to close RobloxPlayerBeta.exe using scripts from your game. But you can kick the player out of the server.

Here's a demonstration of how to do it:

local PLAYER = game.Players:FindFirstChild("PLAYERNAMEHERE")
local BUTTON = script.Parent:FindFirstChild("BUTTON")

BUTTON.MouseButton1Down:Connect(function()
    PLAYER:Kick("You have kicked yourself, congratulations.")
end)

The PLAYER:Kick() function can be called from both ServerScript and LocalScript. Just remember that you can only kick the LocalPlayer from a LocalScript. The argument inside :Kick() is the reason. It can be empty as it's defaulted to nil.

0
Very true. The standard Roblox window UI is not written in Lua, it's written in Visual Basic. No Lua script can interfere with Visual Basic. DeceptiveCaster 3761 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

It's quite simple, really. Let me explain.

Lua is not powerful enough to interfere with the UIs created by Visual Basic and/or C. Although Lua does have a C API outside of Roblox, it can't close that program. Plus, all Lua scripts use UIs written in C, which make things a lot harder than they should.

Roblox uses C for its UI, so Lua can't interfere with it. That being said, you can't close the executable with a Lua script and the only way to close it is by pressing the red button at the top of the UI window. That's all I have to say.

Answer this question