Currently, I am working on a brand new game, starting from scratch. This bit of code will detect how many players are in-game, and edit a UI.
if TotalPlayers >= PlayersReq then
local timeRemaining = 10
while timeRemaining > 0 do
toClient:FireClient(Player, "Intermission... "..timeRemaining)
wait(1)
timeRemaining -= 1
end
afterIntermission()
else
toClient:FireClient(Player, "Must be 2 or more players to play!")
end
Which will send to this local script inside a GUI:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PlayerService = game:GetService("Players")
local PlayerGui = PlayerService.LocalPlayer.PlayerGui
local Label = PlayerGui.Upper.Base.Label
local toClient = ReplicatedStorage:FindFirstChild("coreToClient")
toClient.OnClientEvent:Connect(function(Player, Text)
Label.Text = Text -- Error here.
end)
Output:
14:09:26.380 - Players.Aerosphia.PlayerGui.Upper.Base.Code:10: invalid argument #3 (string expected, got nil)
I’m sending a string, am I not? I don’t get it.
Help would be appreciated, thanks.