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

How do I made a gamemode selection screen?

Asked by 6 years ago

Hi, Im trying to make a roblox game that has different modes, when a player starts the game, I want a menu to pop up and they select a game mode, this will then create a new server based on the gamemode selected, how should i go about doing this (i know how to make the gui, its the server creation im struggling with)

1 answer

Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
6 years ago

If your game is FilteringEnabled, use a RemoteEvent. I don't know the layout you want it to be like. Let's say you have a frame holding all the TextButtons that the player is to press, we'll have to create a remoteevent.

--Server Code

local re = game.ReplicatedStorage.RemoteEvent
local gamemode

re.OnServerEvent:Connect(function(player,txt)
      gamemode = txt
      print(txt)
end)
--Client Code

local gmbuttonframe = script.Parent
local re = game.ReplicatedStorage.RemoteEvent

for _,v in pairs(gmbuttonframe:GetChildren()) do
      if v:IsA('TextButton') then
            v.MouseButton1Down:Connect(function()
                  re:FireServer(v.Text)
            end)
      end
end

Everytime, you click a button on the frame, the server sets the 'gamemode' variable to the text of the button clicked. If the player pressed a button that's text is 'Free - For - All', the server will print 'Free - For - All' in the output.

My roblox profile : https://www.roblox.com/users/273093957/profile

0
Will this create a new server for them to join or will it change the existing server into that gamemode? Peaches_MLG -2 — 6y
0
the code will change the existing server into that gamemode Rare_tendo 3000 — 6y
0
on line 7 it should be if v.ClassName == "TextButton" User#19524 175 — 6y
0
it's 'className', but you can use IsA. It's a function of all instances. Rare_tendo 3000 — 6y
Ad

Answer this question