Hi,
I’m making a game and I’m having problems trying to figure out how to put the status in a textlabel from a server sided module. What is the most efficient way to get the status into a ui?
-- handles the game server side.
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Assets = ReplicatedStorage.Assets
local Packages = ReplicatedStorage.Packages
local Source = ReplicatedStorage.Source
local BridgeNet2 = require(Source.Dependencies.BridgeNet2)
local Settings = require(Source.Dependencies.GameSettings)
local Knit = require(Packages.Knit)
local GameService = Knit.CreateService{
Name = "GameService",
Client = {},
}
local StatusBridge = BridgeNet2.ReferenceBridge("StatusBridge")
local Status = "2+ needed to start. press play!"
local Began = false
local function gamePresync() -- starts up the game
-- count amount of people in dead (dead = players playing.)
local Break = false
Settings.Dead.PlayerAdded:Connect(function(player: Player)
local playerCount = #Settings.Dead:GetPlayers()
if playerCount >= Settings.MinimumPlayers then
Break = false
-- 1-3 = 1 seekers, 4-6 = 2 seekers, 7-9 = 3 seekers.
local seekerCount = math.ceil(playerCount / 3)
-- start intermission
for seconds = Settings.Intermission, 0, -1 do
Status = "starting in: "..seconds.." seconds."
if Break then
Status = "2+ needed to start. press play!"
break
end
task.wait(1)
end
end
end)
Settings.Dead.PlayerRemoved:Connect(function(player: Player)
local playerCount = #Settings.Dead:GetPlayers()
if playerCount < Settings.MinimumPlayers and not Began then
Break = true
end
end)
end
gamePresync()
return GameService