Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Countdown Script not working on server properly?

Asked by 5 years ago

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.

0
Where does it ask to print the Text? Ziffixture 6913 — 5y
0
I'm not sure what you mean yhatayhatahoohoo 15 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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

Ad

Answer this question