I want to disconnect an event, in this case RenderStepped, but it looks like it doesn’t work as the output still prints that it’s running even after using :Disconnect()
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local RSConnection
char.ChildAdded:Connect(function(object)
if string.match(object.Name, "Sword") then
print("Connect")
SwordEquipped = object
RSConnection = RS.RenderStepped:Connect(SwordFunct)
end
end)
char.ChildRemoved:Connect(function(object)
if string.match(object.Name, "Sword") then
print("Disconnect")
RSConnection:Disconnect()
end
end)
Can you be sure that only one char.ChildAdded:Connect(function(object)) is called followed be one char.ChildRemoved:Connect(function(object))? If the first is being called multiple times, RSConnection may be overwritten, leaving a connection live which you can’t disconnect.
If it’s possible this could be the case I’d store the connections as an array table.