I am making a moduel script to tween weld's C0 and C1 but I am making a breaker as well the problem is when I call the function thru a script it wont let me call anything till the module script's function is done running. Any way to fix this?
here is the Module Script's code
local tween = {}
function ifweld(obj)
if obj.ClassName == "Weld" or obj.ClassName == "Motor"
then
print("Tweenable Object")
return true
else
print("Untweenable Object")
end
end
tween.StopTween = function(weld)
print("Function StopTween Called")
check = ifweld(weld)
if check == true
then
if weld:FindFirstChild("Tween") ~= nil
then
weld:FindFirstChild("Tween"):remove()
print("Stopped Tween")
end
end
print("Function StopTween Ended")
end
tween.Tween = function(weld,C0,C1,dur)
local prints = 0
prints = tostring(prints+1)
print("--["..prints.." Function Tween Called")
check = ifweld(weld)
if check == true
then
if weld:FindFirstChild("Tween") ~= nil
then
prints = prints+1
print(tostring(prints).." Running tween prevented called tween")
end
if weld:FindFirstChild("Tween") == nil
then
prints = prints+1
print(tostring(prints).." Availible")
local breaker = Instance.new("StringValue")
breaker.Name = "Tween"
breaker.Value = "Tween Breaker"
breaker.Parent = weld
--
for i = 1, 100 do
wait(1)
if weld:FindFirstChild("Tween") ~= nil
then
print("Found")
else
print("Not Found")
break
end
end
--
end
end
prints = prints+1
print(print("--["..prints.." Tween Ended]--"))
end
return tween
here is the Script's code
local tween = require(script.Parent.WeldTweener)
tween.Tween(script.Parent.Part2.Weld)
wait(.5)
print("Stopped")
the break work's if the stop function is called out of the script that called the tween also.

1 comment
The iteration is a test of the breaker