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.
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