Answered by
4 years ago Edited 4 years ago
This is not a request site, but I'll help.
Make sure this is a script, not a local script. If your warning system is a GUI, you can fire a remote event to this script. More information here.
01 | local DataStoreService = game:GetService( "DataStoreService" ) |
02 | local warnsystem = DataStoreService:GetDataStore( "warnsystem" ) |
03 | game.Players.PlayerAdded:connect( function (plr) |
04 | local system = Instance.new( "Folder" ) |
08 | local secondsuntilunwarn = Instance.new( "NumberValue" ) |
09 | secondsuntilunwarn.Name = secondsuntilunwarn |
10 | secondsuntilunwarn.Value = warnsystem:GetAsync(player.UserID) or 0 |
12 | secondsuntilunwarn.Changed:Connect( function () |
13 | warnsystem:SetAsync(player.UserID, secondsuntilunwarn.Value) |
21 | game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect( function (plr) |
22 | local target = os.time() + 32400 |
24 | local function toHMS(s) |
25 | return ( "i:i:i" ):format(s / 3600 , s / 60 % 60 , s % 60 ) |
28 | plr.system.secondsuntilunwarn.Value = os.time() |
30 | local HMS_Until_Unwarn = (toHMS(target - plr.system.secondsuntilunwarn.Value)) |
What is os.time?
os.time
returns how many seconds have passed since the Unix epoch (1 January 1970, 00:00:00), under current UTC time. If provided a table formatted similarly to that returned by os.date, it will return the number of seconds since that time instead.
How can I fire client to server using remote events?
1 | local RemoteEvent = game.ReplicatedStorage.RemoteEvent |
3 | RemoteEvent:FireServer(data) |