I am having an error at line 1(serverscript): PlayerGui is not a valid member of DataModel.
What I want from the following code is: When a timer hits 0 a GUIis displayed with the winning team.
ServerScript Code:
local policeWinGui = game.PlayerGui.PoliceWinTheGame:WaitForChild("TextLabel")
game.ReplicatedStorage.winnerEvent.OnServerEvent:Connect(function()
policeWinGui.Visible = true
end)
Here is the local script:
script.Parent.Text = seconds.Value
for i=1, seconds.Value do
wait(1)
--decrement by 1
seconds.Value -= 1
--Update label
script.Parent.Text= seconds.Value
--If time is over
if seconds.Value <= 0 then
if not _G.carStollen then
print("Police Win")
game.ReplicatedStorage.winnerEvent:FireServer()
elseif _G.carStollen then
thivesWinGui.Visible = true
print("Thives Win")
end
end
end

2 comments
It worked, thanks!
np