Skip to content

Commit

Permalink
Fix InstanceStream exploit
Browse files Browse the repository at this point in the history
  • Loading branch information
hoontee committed Nov 12, 2024
1 parent c2334ac commit e0cf61d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions Pronghorn/New.luau
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ function New.InstanceStream(): InstanceStream<...any>
end)

replicator.Parent = player.PlayerGui
task.delay(10, replicator.Destroy, replicator)
end

return uid
Expand All @@ -453,12 +454,17 @@ function New.InstanceStream(): InstanceStream<...any>
Listen = function(self: InstanceStream<...Instance>, uid: string): (Event<...Instance>, Event<Instance>)
if IS_SERVER then error("InstanceStream.Listen cannot be called on the server", 0) end

local container = assert(localPlayer.PlayerGui:FindFirstChild("__instanceStream_" .. uid), `Cannot find InstanceStream with UID '{uid}'`) :: RemoteEvent
local replicator = assert(localPlayer.PlayerGui:FindFirstChild("__instanceStream_" .. uid), `Cannot find InstanceStream with UID '{uid}'`) :: RemoteEvent
local numInstances = assert(tonumber(uid:split("_")[2]))
local finishedEvent: Event<...Instance> = New.QueuedEvent("InstanceStream Finished Event")
local streamEvent: Event<Instance> = New.QueuedEvent("InstanceStream Stream Event")

for _, child in container:GetChildren() do
replicator.Destroying:Connect(function()
finishedEvent:DisconnectAll()
streamEvent:DisconnectAll()
end)

for _, child in replicator:GetChildren() do
assert(child:IsA("ObjectValue"))
if child.Value then
table.insert(self.Instances, child.Value)
Expand All @@ -472,17 +478,17 @@ function New.InstanceStream(): InstanceStream<...any>
end
end

if #container:GetChildren() == numInstances then
if #replicator:GetChildren() == numInstances then
finishedEvent:Fire(table.unpack(self.Instances))
container:FireServer()
replicator:FireServer()
else
container.ChildAdded:Connect(function(child: Instance)
replicator.ChildAdded:Connect(function(child: Instance)
assert(child:IsA("ObjectValue") and (child.Value or child.Changed:Wait() and child.Value))
table.insert(self.Instances, child.Value)
streamEvent:Fire(child)
if #container:GetChildren() == numInstances then
if #replicator:GetChildren() == numInstances then
finishedEvent:Fire(table.unpack(self.Instances))
container:FireServer()
replicator:FireServer()
end
end)
end
Expand Down
2 changes: 1 addition & 1 deletion Pronghorn/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
║ ██████▀██▓▌▀▌ ▄ ▄▓▌▐▓█▌ ║
║ ║
║ ║
║ Pronghorn Framework Rev. B74
║ Pronghorn Framework Rev. B75
║ https://github.com/Iron-Stag-Games/Pronghorn ║
║ GNU Lesser General Public License v2.1 ║
║ ║
Expand Down

0 comments on commit e0cf61d

Please sign in to comment.