diff --git a/Pronghorn/Remotes/init.lua b/Pronghorn/Remotes/init.lua index e0db2d4..2e0f2b3 100644 --- a/Pronghorn/Remotes/init.lua +++ b/Pronghorn/Remotes/init.lua @@ -69,20 +69,29 @@ local function connectEventClient(remote: RemoteFunction | UnreliableRemoteEvent end elseif remote:IsA("UnreliableRemoteEvent") or remote:IsA("RemoteEvent") then + local lastRandom = script:GetAttribute("Random") actions.Connect = function(_, func: (...any) -> ()): RBXScriptConnection return (remote :: RemoteEvent).OnClientEvent:Connect(func) end actions.Fire = function(_, ...: any?) - Print(getEnvironment(), debugPrintText, {...}) - return (remote :: RemoteEvent):FireServer(...) + local nextRandom = script:GetAttribute("Random") + if not remote:IsA("UnreliableRemoteEvent") or nextRandom ~= lastRandom then + lastRandom = nextRandom + Print(getEnvironment(), debugPrintText, {...}); + (remote :: RemoteEvent):FireServer(...) + end end metaTable.__call = function(_, context: any, ...: any?) + local nextRandom = script:GetAttribute("Random") if context ~= Remotes[moduleName] then error(`Must call {moduleName}:{remote.Name}() with a colon`, 0) end - Print(getEnvironment(), debugPrintText, {...}); - (remote :: RemoteEvent):FireServer(...) + if not remote:IsA("UnreliableRemoteEvent") or nextRandom ~= lastRandom then + lastRandom = nextRandom + Print(getEnvironment(), debugPrintText, {...}); + (remote :: RemoteEvent):FireServer(...) + end end end end @@ -222,7 +231,13 @@ end --- @ignore function Remotes:Init() if RunService:IsServer() then + local random = Random.new(os.clock()) + remotesFolder = New.Instance("Folder", ReplicatedStorage, "__remotes") + + RunService.Heartbeat:Connect(function(_dt: number) + script:SetAttribute("Random", random:NextNumber()) + end) else remotesFolder = ReplicatedStorage:WaitForChild("__remotes") :: Folder diff --git a/Pronghorn/init.lua b/Pronghorn/init.lua index 451abe7..ba4dcc9 100644 --- a/Pronghorn/init.lua +++ b/Pronghorn/init.lua @@ -29,7 +29,7 @@ ║ ██████▀██▓▌▀▌ ▄ ▄▓▌▐▓█▌ ║ ║ ║ ║ ║ -║ Pronghorn Framework Rev. B55 ║ +║ Pronghorn Framework Rev. B56 ║ ║ https://github.com/Iron-Stag-Games/Pronghorn ║ ║ GNU Lesser General Public License v2.1 ║ ║ ║