Half Update Done
Now, when you stop the timer you can add a callback, using BreakTimer(function() print('callback!') end)
I’ll add it into documentation tomorrow.
If you still haven’t seen documentation yet, click on the top image, or click here: documentation
Why are the teleport function in lowercase but the others are in Pascal Case?
From the ModuleScript StoryModule
Why not not cancelled instead of cancelled == false? Why not ReplicatedStorage.StoryModuleRemotes instead of ReplicatedStorage["StoryModuleRemotes"]?
function story.Countdown(secs,callback)
canceled = false
game.ReplicatedStorage["StoryModuleRemotes"].startCount:FireAllClients(secs)
wait(secs)
if canceled == false then
callback()
end
end
And why not game:GetService("ReplicatedStorage") instead of game.ReplicatedStorage?
From StartGui/MainGui/Current
a.startCount.OnClientEvent:Connect(function(secs)
script.Canceled.Value = false
local t = secs
script.Parent.Countdown.Visible = true
script.Parent.Countdown.Count.Text = tostring(t)
while wait(1) do
if script.Canceled.Value == true then
script.Parent.Countdown.Visible = false
break
else
t -= 1
script.Parent.Countdown.Count.Text = tostring(t)
if t <= 0 then
script.Parent.Countdown.Visible = false
break
end
end
end
end)
First, why tostring on a number as numbers and strings are automatically converted when doing mostly anything with them?
Secondly, why not for loops?
Thridly why not set the CountdownValue.Visible to false after the for loop as it looks like both break have it.
function show(fr)
local fade = tweenService:Create(fr, TweenInfo.new(0.4,Enum.EasingStyle.Cubic), {Size = fr.Size, Position = UDim2.new(0.5, 0,0.15, 0)})
fade:Play()
wait(fade.TweenInfo.Time)
end
function hide(fr)
local fade = tweenService:Create(fr, TweenInfo.new(0.4,Enum.EasingStyle.Cubic), {Size = fr.Size, Position = UDim2.new(0.5, 0,-1, 0)})
fade:Play()
wait(fade.TweenInfo.Time)
end
Why wait instead of fade.Completed:Wait()?
I noticed you’re using wait, you should avoid using them