I couldn’t find any documentation on a built-in function like this, such as Instance:GetConnections() or anything like that, so I’m wondering if there’s a way to see what events are connected to an object currently. Thanks!
There isn’t a built in way to do this, but you can manually store the connections linked to parts with a dictionary.
Psuedocode:
local connections = {}
connections[workspace.Part] = workspace.Part:Connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent) then
connections[workspace.Part]:Disconnect(0
end
end)
If to have multiple connections for a single object stored, you would need to do a bit more work by creating a table for each index connections[ObjectInstance]
.