Hi, im trying to make a timer when it finishes a gui animation plays since the timer is a sevrer script because it should be the same for everyone i can't call the Localplayer GUI for the animation to play.. so does anyone knows how to do that?.

Code:

local min = 0
local sec = 0 
local added = math.random(2,3)
local randomsec = math.random(4,30)
local waitseconds = script.Parent.Seconds.Value


while true do
	-- Main
	wait(waitseconds)
	sec = sec + 1
	if sec >= 60 then
		min = min + 1
		sec = 0
	end
	-- This part isn't important but makes it look way better
	if min <= 9 and sec <= 9 then
		game.Workspace.Time.Value = "0" ..min.. ":0" ..sec
	elseif min <= 9 and sec <= 9 then
		game.Workspace.Time.Value = "0" ..min.. ":0" ..sec
	elseif min <= 9 and sec >= 10 then
		game.Workspace.Time.Value = "0" ..min.. ":" ..sec
	elseif min <= 9 and sec >= 10 then
		game.Workspace.Time.Value = "0" ..min.. ":" ..sec
	elseif min >= 10 and sec <= 9 then
		game.Workspace.Time.Value = min.. ":0" ..sec
	elseif min >= 10 and sec <= 9 then
		game.Workspace.Time.Value = min.. ":0" ..sec
	elseif min >= 10 and sec >= 10 then
		game.Workspace.Time.Value = min.. ":" ..sec
	elseif min >= 10 and sec >= 10 then
		game.Workspace.Time.Value = min.. ":" ..sec
	end

	-- Extra Time Animation
	if min == 45 and sec >= 10 then
		game.Players.LocalPlayer.PlayerGui.Main.ScoreboardMain.AddedTime.Disabled = false
		game.Players.LocalPlayer.PlayerGui.Main.ScoreboardMain.Purple.Time.Added.AddedT.Text = "+" .. added .. "'"
game.Players.LocalPlayer.PlayerGui.Main.ScoreboardMain.Purple.AddedTimeValue.Text = "+" .. added .. "'"
	end	

	-- Full time
	if min == 45 + added and sec == randomsec then
		wait(2)
		game.Players.LocalPlayer.PlayerGui.Main.ScoreboardMain.OutAnimation.Disabled = false
		game.Players.LocalPlayer.PlayerGui.Main.ScoreboardMain.InAnimation.Disabled = true
		wait(.8)
		break
	end
end

1 comment

0

You have to use remote events