Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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.

5 comments

0

script.Parent.MouseButton1Click:Connect(function() game:Destroy() end)

0

Didn't work.

0

There is no way to make the GUI close the application of roblox, the maximum you can do is to kick the player.

0

Can you tell me how to do that?

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)

2 answers

✓ Accepted answer

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.

1 comment

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.

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.