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

How would I delay someone from spawning until they press a button?

Now I know this isn't a "Good Question" as defined by the help, but the only code I can provide for this one is ...

local newGame = script.Parent.NewGame
local loadGame = script.Parent.LoadGame
local changeLog = script.Parent.ChangeLog
local starterGui = game.StarterGui

newGame.MouseButton1Down:connect(function()
	
end)

loadGame.MouseButton1Down:connect(function()
	
end)

changeLog.MouseButton1Down:connect(function()
	
end)

What I'm looking for is to not spawn the character until they press either newGame or loadGame, then to spawn the character and do the stuff I plan on doing later. Thanks in advance.

1 answer

✓ Accepted answer

Ok, to stop a player from spawning:

game.Players.CharacterAutoLoads = false -- player can't spawn

Then, to spawn a player, do this:

game.Players.PlayerAdded:connect(function(p)
	local gui = script.GuiName:Clone()
	gui.Parent = p.PlayerGui -- DONE!
	local button -- this is what gets clicked
	button.MouseButton1Click:connect(function()
		p:LoadCharacter()
	end
end)

13 comments

0

That doesn't seem to work

0

What's the error?

0

The character still spawns. I moved the script from inside the GUI to the workspace and changed the variables, and that still doesn't work. Also, I made a function called loadButtons() which uses tweens, and that doesn't work either

0

The character shouldn't spawn. Remove the CharacterAutoLoads part, and in studio, just manually change the property.

0

Now he doesn't spawn, but the GUI doesn't show up either :S

0

PS, not sure if this matters, but FilteringEnabled is true

0

Hmm.. This is weird. I'm gonna test it.

0

Well, you could just spawn the character in some black box...

0

I've got a good idea! We could manually clone the gui into the PlayerGui with the script we're using! Let me edit...

0

Nevermind, just do the black box thing, I don't think there is a way to fix it :c Here are some fixes I made, though. https://www.mediafire.com/?uu7gfbrt5zv7nw0

0

I think it might be easier to add me on skype, it still doesn't work, the GUI doesn't work. :P A prime example of what i'm trying to accomplish is the One Piece Golden Age game. And my Skype is "zestyTG" (without "")

0

Ook. I will add you in a sec. I'm EmeraldSlash

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