Skip to content

Commit

Permalink
Don't make a new connection if one already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Reselim committed Aug 19, 2020
1 parent 0210d8b commit cbd7189
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/BaseMotor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ function BaseMotor:onComplete(handler)
end

function BaseMotor:start()
self:stop() -- Stop any existing connections, if they exist

self._connection = RunService.RenderStepped:Connect(function(deltaTime)
self:step(deltaTime)
end)
if not self._connection then
self._connection = RunService.RenderStepped:Connect(function(deltaTime)
self:step(deltaTime)
end)
end
end

function BaseMotor:stop()
Expand Down

0 comments on commit cbd7189

Please sign in to comment.