server script
game.ReplicatedStorage.vote2.OnServerEvent:Connect(function(player, add, state)
if state == "Daily" then
print("daily")
local timeStore = DataStore2("TimeStore", player)
timeStore:Set(os.time())
local times = timeStore:Get()
game.ReplicatedStorage.timeRemaining:FireClient(player, os.time(), true)
end
end)
game.ReplicatedStorage.vote1.OnServerEvent:Connect(function(player, add, state)
if state == "Daily" then
local timeStore = DataStore2("TimeStore", player)
timeStore:Set(os.time())
local times = timeStore:Get()
game.ReplicatedStorage.timeRemaining:FireClient(player, os.time(), true)
end
end)
local script
local text = script.Parent
local function convertTime(n)
local String
local hours = (math.floor(n / 3600))
local minutes = (math.floor((n - (hours* 3600)) / 60))
local seconds = (math.floor(n-(hours*3600)-(minutes*60)))
if hours <= 9 then
hours = "0"..hours
end
if minutes <= 9 then
minutes = "0"..minutes
end
if seconds <= 9 then
seconds = "0"..seconds
end
if hours ~= 0 and minutes ~= 0 and seconds ~= 0 then
String = hours..":"..minutes..":"..seconds
else
String = "You are able to vote!"
end
return String
end
game.ReplicatedStorage.timeRemaining.OnClientEvent:Connect(function(lastClaim, available)
while task.wait(1) do
text.Text = convertTime((24*60*60) + lastClaim - os.time())
end
end)
after the vote function is called, the UI keeps changing between the previous time and the new time
how do i fix this bug?