Im trying to make a dice rolling script but it freezez at the part where I make it repeat the pivot until it works and then it says
local TweenService = game:GetService("TweenService")
local module = {}
function module.Roll(Dice)
print(Dice)
local og = Dice.OCF
for count = 1, 100 do
Dice.Model:PivotTo(CFrame.new(CFA.Position, Vector3.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))))
task.wait(math.random(3, 5)/100)
end
task.wait(0.02)
local Roll = math.random(1, #Dice.RollCFrames:GetChildren())
repeat
Dice.Model:PivotTo(og.Value)
print(og.Value)
until Dice.Model.PrimaryPart.CFrame == og.Value
repeat
Dice.Model:PivotTo(Dice.RollCFrames:FindFirstChild(tostring(Roll)).Value)
print(Dice.RollCFrames:FindFirstChild(tostring(Roll)).Value)
until Dice.Model.PrimaryPart.CFrame == Dice.RollCFrames:FindFirstChild(Roll).Value
print(Dice.RollCFrames:FindFirstChild(Roll).Value)
return Roll
end
return module