so I created a script that creates a tween for every light model.The problem is that I want to stop the tween if the player is far from the lights but when I use tween3:Pause() it doesnt stop the tween.I know that the script is very bad but I dont have a lot of ideas on how to improve that
runservice.Stepped:Connect(function()
if db2 == true then
local pos2 = player.Character.HumanoidRootPart.Position
for x,xs in pairs (Parent:GetChildren()) do
local tween3 = tweenservice:Create(xs.on,tweeninfo2,properties3)
tween3:Play()
if ( pos2 - pos1 ).magnitude >= 9 then
print(( pos2 - pos1 ).magnitude)
tween3:Pause()
else
end
end
end
end)