I'm trying to make a starting guis where theres multiple buttons consisting of "Play, Options, Extra, and Exit" But i can't come up with a script to make it all function. I want to disable character spawning until he/she presses play and chooses his/her job, and I'm trying to make the game exit when ever i press the exit button. Please help me I've been looking hard for a way to do this.
✓ ANSWER ACCEPTED
Main Title Gui Help?
2 answers
✓ Accepted answer
Here is a script I made in another post it will stop a character from loading:-
local respawnDelay = 15 -- delay time
game.Players.CharacterAutoLoads = false --Stop character auto load
game.Players.PlayerAdded:connect(function(player) -- new player in the game added
player.CharacterAdded:connect(function(character) -- character sporns/ re-sporns
local humanoid = character:FindFirstChild("Humanoid") -- find humanoid in character
if humanoid then -- humanoid is found
humanoid.Died:connect(function() -- add a humanoid died event
humanoid.Parent:Destroy() -- cleanup character or it will stay in the game
wait(respawnDelay) -- wait for specified time
player:LoadCharacter() -- load new character
end)
end
end)
wait(respawnDelay) -- delay for new player when they join the game
player:LoadCharacter() -- load character
end)
To answer your other question you may need to look into a loading Gui like my place. My Place
Edit disconnects player from gui:-
Localscript in the GUI:-
script.Parent.MouseButton1Click:connect(function ()
game.Workspace.disconnectPlayer:FireServer() --The location of the remove function
end)
In the server script:-
local event = Instance.new("RemoteEvent")
event.Parent = game.Workspace -- This needs to be somewhere the player can access
event.Name = "disconnectPlayer"
--You can create the object but decided to create on in this script
event.OnServerEvent:connect(function(plr,msg) --Player name is passed to the script
local gplr = game.Players:FindFirstChild(plr.Name) --finds the player in Players
gplr:Kick() --kicks the user
end)
This tutorial may be off some use to you m8: http://youtu.be/j2NkgD4lqeU
This discussion is preserved as it was. New answers, comments, and votes are closed.

6 comments
But do you know how to create an exit script? Thank you for the spawn script but the exit script is the most important. :)
You can use the kick event for the player http://wiki.roblox.com/index.php?title=API:Class/Player/Kick. This needs to be on the server and you will need to setup a remote event from the client to the server. http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial
I carnt make the the script today but i can make one tomurrow.
Please do. Thank you very much.
I have added the script. Hope this helps
Thank you so much! ????