Skip to content

Commit 3605500

Browse files
committed
fix: Added disconnect to stop function
1 parent b4ba1ee commit 3605500

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src-build/init.luau

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ function Class.Start(): { Stop: () -> () }
639639
SB_UNINDENT_LOG()
640640
end
641641

642-
CollectionService:GetInstanceAddedSignal("SmartBone"):Connect(SetupObject)
642+
connection = CollectionService:GetInstanceAddedSignal("SmartBone"):Connect(SetupObject)
643643

644644
for _, Object in CollectionService:GetTagged("SmartBone") do
645645
SetupObject(Object)
@@ -675,6 +675,11 @@ function Class.Start(): { Stop: () -> () }
675675
for _, Actor: Actor in ActorFolder:GetChildren() do
676676
Actor:SendMessage("Destroy")
677677
end
678+
679+
if connection then
680+
connection:Disconnect()
681+
connection = nil
682+
end
678683
end,
679684
}
680685
end

src/init.luau

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ function Class.Start(): { Stop: () -> () }
639639
SB_UNINDENT_LOG()
640640
end
641641

642-
CollectionService:GetInstanceAddedSignal("SmartBone"):Connect(SetupObject)
642+
connection = CollectionService:GetInstanceAddedSignal("SmartBone"):Connect(SetupObject)
643643

644644
for _, Object in CollectionService:GetTagged("SmartBone") do
645645
SetupObject(Object)
@@ -675,6 +675,11 @@ function Class.Start(): { Stop: () -> () }
675675
for _, Actor: Actor in ActorFolder:GetChildren() do
676676
Actor:SendMessage("Destroy")
677677
end
678+
679+
if connection then
680+
connection:Disconnect()
681+
connection = nil
682+
end
678683
end,
679684
}
680685
end

0 commit comments

Comments
 (0)