Try this, it fires to all clients. I'll explain. I created a variable with info about the wave, and sent it through the remote event so when the clients all receive it, the data is passed through and will properly update their gui,
Here's the edited server script:
Remember to Insert a remote event in replicated storage and name it "UpdateAllClients"
local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = replicatedStorage:WaitForChild("UpdateAllClients")
local spawns = script.Parent
local spawnTime = 30
local wave = game.StarterGui.ScreenGui.Value.Value
while true do
updateClientsGui = 'Wave: '..wave
remoteEvent:FireAllClients(updateClientsGui)
wait(spawnTime)
wave += 1
for _, spwn in pairs(spawns:GetChildren()) do
if spwn:IsA('BasePart')then
local ZombieClone = game.ReplicatedStorage.Zombie:Clone()
ZombieClone.Parent = workspace
ZombieClone.HumanoidRootPart.CFrame = CFrame.new(spwn.Position + Vector3.new(0,3,0))
end
end
end
Now create a local script in StarterPlayerScripts and paste the following:
local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = replicatedStorage:WaitForChild("UpdateAllClients")
remoteEvent.OnClientEvent:Connect(function(updateClientsGui)
local player = game.Players.LocalPlayer
player.PlayerGui.ScreenGui.TextLabel.Text = updateClientsGui
end)
1 comment
is this a local script or server-sided script?