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

Main Title Gui Help?

Asked by 9 years ago

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.

2 answers

Log in to vote
0
Answered by 9 years ago

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)
0
But do you know how to create an exit script? Thank you for the spawn script but the exit script is the most important. :) alberthutchins 12 — 9y
0
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 User#5423 17 — 9y
0
I carnt make the the script today but i can make one tomurrow. User#5423 17 — 9y
0
Please do. Thank you very much. alberthutchins 12 — 9y
View all comments (2 more)
0
I have added the script. Hope this helps User#5423 17 — 9y
0
Thank you so much! ???? alberthutchins 12 — 9y
Ad
Log in to vote
-1
Answered by 9 years ago

This tutorial may be off some use to you m8: http://youtu.be/j2NkgD4lqeU

Answer this question