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

Help with GUI creation via RemoteEvent?

Asked by
waifuSZN 123
8 years ago
Edited 8 years ago
01local Players = game:GetService("Players")
02local SpawnLocations = workspace.SpawnLocations
03local requiredPlayers = 15
04local i = 1
05 
06Players.CharacterAutoLoads = false
07 
08Players.PlayerAdded:Connect(function(Player)
09    Player.RespawnLocation = SpawnLocations[i] -- Assign new Player to a Spawn
10    i = i + 1
11    Player:LoadCharacter()
12end)
13 
14local event = game.ReplicatedStorage.RemoteEvent
15event.Name = "playercountGUI"
View all 22 lines...
01while i ~= requiredPlayers do
02    local screenGui = Instance.new("ScreenGui")
03    screenGui.Parent = script.Parent
04    local textLabel = Instance.new("TextLabel")
05    textLabel.Parent = screenGui
06    textLabel.Position = UDim2.new(0, 495, 0, 25)
07    textLabel.Size = UDim2.new(0, 150, 0, 50)
08    textLabel.BackgroundColor3 = BrickColor.Black().Color
09    textLabel.BackgroundTransparency = 0.5
10    textLabel.Font = Enum.Font.ArialBold
11    textLabel.Fontsize = Enum.FontSize.Size18
12    textLabel.Text = "Players: " .. i
13    textLabel.TextColor3 = BrickColor.White().Color
14end

The first part of code defines the event, while the second part of the code is the event I have coded.

My issue is I have absolutely NO IDEA how to transfer the variable i between the event and the code.

Please help. (This is also my first time creating a RemoteEvent.)

0
Is this the entirety of the code, on both clientside and server-side? `i` is never defined, here. Pyrondon 2089 — 8y
0
No, but I can post everything. waifuSZN 123 — 8y
0
Posted the whole code waifuSZN 123 — 8y
0
At no point during this code are you firing the event. You have created it but you're not activating it. Foreshadowed_Dawn 4 — 8y
View all comments (2 more)
0
I'm unsure how to activate it. waifuSZN 123 — 8y
0
I may be a little late, but to fire the event to the server, use :FireServer() on the LocalScript Mayk728 855 — 8y

Answer this question