Help with GUI creation via RemoteEvent?
Asked by
8 years ago Edited 8 years ago
01 | local Players = game:GetService( "Players" ) |
02 | local SpawnLocations = workspace.SpawnLocations |
03 | local requiredPlayers = 15 |
06 | Players.CharacterAutoLoads = false |
08 | Players.PlayerAdded:Connect( function (Player) |
09 | Player.RespawnLocation = SpawnLocations [ i ] |
11 | Player:LoadCharacter() |
14 | local event = game.ReplicatedStorage.RemoteEvent |
15 | event.Name = "playercountGUI" |
16 | event.Parent = game.Workspace |
18 | while i ~ = requiredPlayers do |
19 | event.OnServerEvent:connect( function () |
01 | while 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 = UDim 2. new( 0 , 495 , 0 , 25 ) |
07 | textLabel.Size = UDim 2. new( 0 , 150 , 0 , 50 ) |
08 | textLabel.BackgroundColor 3 = BrickColor.Black().Color |
09 | textLabel.BackgroundTransparency = 0.5 |
10 | textLabel.Font = Enum.Font.ArialBold |
11 | textLabel.Fontsize = Enum.FontSize.Size 18 |
12 | textLabel.Text = "Players: " .. i |
13 | textLabel.TextColor 3 = BrickColor.White().Color |
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.)