I've attempted for over an hour now, researching Roblox's help pages and other sources, and haven't found a reason to why this isn't working as planned. It's supposed to change the time of day for all users and it still continues to fail.
Here's the code for the slider I added to change the in-game time:
local textB = script.Parent
local frame = textB.Parent
local max = frame.Max
local fire = max.Fire
local bar = max.Bar
local as = Vector2.new(max.AbsoluteSize.X, max.AbsoluteSize.Y)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteFunction = ReplicatedStorage:WaitForChild("TimeManagement")
fire.Changed:Connect(function()
if fire.Value == true then
local maxSize = as.X
local size = bar.Size.X.Offset
local num = 24 * (size / maxSize)
textB.Text = math.floor(num) + 1
local almostThere = math.floor(num) + 1
local newTime = almostThere * 60
remoteFunction:InvokeServer(newTime) -- Important Line
end
end)
Here's the code for the Server Script that I thought would work:
game:GetService("Lighting")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteFunction = ReplicatedStorage:WaitForChild("TimeManagement")
local function onTimeUpdate(newestTime)
game:GetService("Lighting"):SetMinutesAfterMidnight(newestTime)
end
remoteFunction.OnServerInvoke = onTimeUpdate

1 comment
Despite updating my scripts using your rewrite, I'm still unable to reach the desired outcome.