Why are you trying to Tween every Heartbeat? This means it will replay the Tween again practically before it starts. I don’t know what you are doing, but RunService does not seem like the right option here.
If this is the case, just set the “repeat count” property of TweenInfo to -1. This will cause it to repeat infinitely.
Example:
local tweenInfo = TweenInfo.new(
.35, -- Time
Enum.EasingStyle.InOut, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
You can use @ExcessEnergy method, or to make your current one work just make that tween method return the tween after it is played from the module, and do this: (Also, you do not need to use spawn because the connection won’t yield the thread, also if you want to make a new thread use coroutines instead)
local Tween
New = game:GetService("RunService").Heartbeat:Connect(function()
if (Tween) and (Tween.PlaybackState ~= Enum.PlaybackState.Completed) then
return
end
Tween = Methods.Tween(Location, .35, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, 0, false,0, {StudsOffset = Vector3.new(0,math.random(12,14),0)})
end)
end)