I am trying to make it so while a value is true it plays a function every 0.2 second. But the function it is trying to play cannot run multiple times at the same time. How do I make the RandomRodTween() function be played multiple times and make the “while wait(1)” function play the RandomRodTween() every 0.2 of a second while the value is over >2000? Any help appreciated
local Rods = Rod:GetChildren()
local TempHigh = false
function RandomRodTween()
wait(0.5)
local RandomRod = Rods[math.random(1, #Rods)]
local tweenService = game:GetService("TweenService")
local tweenup = tweenService:Create(RandomRod, TweenInfo.new(0.8,Enum.EasingStyle.Exponential, Enum.EasingDirection.Out, 0, false, 0 ), {Position = Vector3.new(RandomRod.Position.X, RandomRod.Position.Y + 0.8, RandomRod.Position.Z)})
local tweendown = tweenService:Create(RandomRod, TweenInfo.new(0.5,Enum.EasingStyle.Bounce, Enum.EasingDirection.Out, 0, false, 0 ), {Position = Vector3.new(RandomRod.Position.X, RandomRod.Position.Y, RandomRod.Position.Z)})
-- Replace "Rod.SoundPart" with RandomRod!!!!!!!!
tweenup:Play()
wait(0.8)
tweendown:Play()
end
while wait(1) do
if Temperature.Value >= 2000 then
RandomRodTween()
wait(0.1)
end
end