I’m trying to make a fully random event generator script and the whole thing works (I checked it with prints) except when it is supposed to run back around to the starting point. The end of the script has the same values as the ones for the timer part (TimerValue.value > 0, ActivatedValue.value == 2 etc) but it doesn’t really work, do you see any bugs?
(here is the script btw, I shortened it to the main part that I think is not working)
local MainValue = script.Parent.Parent.MainValue
local TimeToBreakValue = script.Parent.Parent.TimeToBreak
local ActivatedYesOrNoValue = script.Parent.Parent.ActivatedYesOrNo
local ProxPrompt = script.Parent
local ProxPromptService = game:GetService("ProximityPromptService")
local Light = script.Parent:WaitForChild("Light")
if ActivatedYesOrNoValue.Value == 2 and MainValue.Value == 3 then
repeat
TimeToBreakValue.Value = TimeToBreakValue.Value - 1
task.wait(1)
until
TimeToBreakValue.Value == 0
print("All Clear in Timer IfElse")
end
ProxPrompt.Triggered:Connect(function()
Light.PointLight.Enabled = true
ProxPrompt.Enabled = false
HighLightPart.Highlight.Enabled = false
ActivatedYesOrNoValue.Value = 2
TimeToBreakValue.Value = 30
MainValue.Value = 3
print("All Clear in prompt triggered")
print(MainValue.Value, TimeToBreakValue.Value, ActivatedYesOrNoValue.Value)
end)