Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Countdown Script not working on server properly?

Hello, I'm having a problem with Remoteevents. Here's the script for both and heirarchy:

Localscript:

local repStorage = game:GetService("ReplicatedStorage")
local starterGUI = game:GetService("StarterGui")
local countDownMain = script.Parent.Parent
local countDownFrame = countDownMain.CountDownFrame
local countDownText = countDownFrame.CountDownText
local countDownRemote = repStorage:WaitForChild("CountDownRemote")


local function countDown()
	for i = 10, 1, -1 do
		print(i)
		countDownText.Text = i
		wait(1)
		if i == 1 then
			countDownText.Text = "Beginning..."
		end
	end
end

countDownRemote.OnClientEvent:Connect(countDown)

Server script:

local repStorage = game:GetService("ReplicatedStorage")
local gameStart = repStorage:WaitForChild("GameStart")
local countDownRemote = repStorage:WaitForChild("CountDownRemote")

repeat wait() until gameStart.Value == false
	countDownRemote:FireAllClients()

Heirarchy: https://i.gyazo.com/95f972154bfebf62d279bb35323ebac1.png

Whenever I run the game, the script seems to work in client mode, but when I switch to server mode the i value prints, but the text on the GUI does not. When running it on test mode, it appears to not work whatsoever. Thanks.

2 comments

0

Where does it ask to print the Text?

0

I'm not sure what you mean

1 answer

The server is not a player so it has no PlayerGui

StarterGui Gives a copy of it self to a player when they join. Thats why

This discussion is preserved as it was. New answers, comments, and votes are closed.