You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want a shop that updates every 10 minutes, I just need something that can detect when it’s been 10 minutes so I can call a local function to update the shop, I need it to be synced across all servers. -
What is the issue? Include screenshots / videos if possible!
I have looked all over the dev forum but there are only shops that update daily, nothing that updates every 10 minutes. I tried converting to update every 10 minutes but failed. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried everything available on the developer hub, I just can’t figure out how to make it every ten minutes.
This is my current code
local function toHMS(s) -- Just a function for time formatting
return string.format("%02i:%02i:%02i", s/60^2, s/60%60, s%60)
end
function getAvailableItems(day)
local rng = Random.new(day)
local shopItems
local item = items[rng:NextInteger(1, #items)]
shopItems = item
return shopItems
end
local shopupdater = coroutine.create(function()
while wait(1) do
local day = math.floor(((timemodule.time() + offset) / (60 * 60 * 24))/600)
local t = (math.floor(timemodule.time())) + offset -- Sets the date to Thursday 5PM PST
local origtime = t - offset
local daypass = origtime % 86400
local timeleft = 86400 - daypass
local timeleftstring = toHMS(timeleft)
print(day)
local stringy = "New trail in: ".. timeleftstring -- Optional printout, obviously I'd use "timeleftstring" for a countdown timer in a shop
game.ReplicatedStorage.Events.CurrentTrailTime:FireAllClients(stringy)
if day ~= currentDay then
currentDay = day
currentShopItems = getAvailableItems(day)
game.ReplicatedStorage.Events.CurrentTrail:FireAllClients(currentShopItems)
currenttrail = currentShopItems
print('Updated shop items')
end
end
end)
coroutine.resume(shopupdater)