Oh lol wait you right, i wrote something strange xd
No errors now in output finallly
Itâs seems what itâs donât detect CD(click detector), bec value doesnât change
Uhmm still canât figure problem
Okay, nevermind iâm stupid, but when value is false again, script donât start that script again
Okay i found a stupid way to fix that script lol
You should bring the clickdetecter event and the function outside of the while loop. And put it between local RandomNumber = 0
and while FactoryBrokenValue.Value == false do
. I guess.
I already fixed that so everything works, thank you anyways
Okay i canât detect if value changes, how do i rework that to detect if value changed?
script:
local MoneyLevel = script.Parent.Parent.Parent.MoneyLevel
local SpeedLevel = script.Parent.Parent.Parent.SpeedLevel
local MainPart = script.Parent.Parent.MainPart
local FactoryBrokenValue = script.Parent.Parent.FactoryBroken
local DB = true
if MoneyLevel.Value == 0 then
if SpeedLevel.Value == 0 then
while FactoryBrokenValue.Value == false do
wait(0.8)
script.Parent.Position = Vector3.new(42.434, 10.85, -335.235)
local PlrBricks = script.Parent.Parent.Parent.PlayerBricks
PlrBricks.Value = PlrBricks.Value + 1
script.Parent.Anchored = true
script.Parent.Transparency = 1
wait(3)
script.Parent.Anchored = false
script.Parent.Transparency = 0
end
end
end
if SpeedLevel.Value == 1 then
if MoneyLevel.Value == 0 then
while FactoryBrokenValue.Value == false do
wait(0.8)
script.Parent.Position = Vector3.new(42.434, 10.85, -335.235)
local PlrBricks = script.Parent.Parent.Parent.PlayerBricks
PlrBricks.Value = PlrBricks.Value + 1
script.Parent.Anchored = true
script.Parent.Transparency = 1
wait(2)
script.Parent.Anchored = false
script.Parent.Transparency = 0
end
end
end
if SpeedLevel.Value == 1 then
if MoneyLevel.Value == 1 then
while FactoryBrokenValue.Value == false do
wait(0.8)
script.Parent.Position = Vector3.new(42.434, 10.85, -335.235)
local PlrBricks = script.Parent.Parent.Parent.PlayerBricks
PlrBricks.Value = PlrBricks.Value + 2
script.Parent.Anchored = true
script.Parent.Transparency = 1
wait(2)
script.Parent.Anchored = false
script.Parent.Transparency = 0
end
end
end
You can use a valueobjectâs Changed event to detect the value has changed
I know that, but where do i put that?
I donât get what your script is doing, but Iâm pretty sure that MoneyLevel and SpeedLevel Detection only run once at the beginning. If you want to refresh and detect them upon a value has changed, just pack 6th line to the end of the code in this:
ValueObject.Changed:Connect(function()
--Detection code(Code of checking MoneyLevel and SpeedLevel)
end)