Basically I'm trying to get the booleanvalue to change, but it doesn't change at all. I'm pretty confused, so how would you change a booleanvalue via script?
local boolvalue = script.Parent.bool local light = game:GetService("Lighting") local alarm = script.Parent.Parent.alarm local message = script.Parent.Parent.corevent local temp = script.Parent.SurfaceGui.Text while true do wait() if temp.Text == "1999°c" then boolvalue = true alarm.Looped = false elseif temp.Text == "2000°c" then script.Parent.Parent.Map.coremachine.coreOverheat.Fire.Enabled = true alarm.Looped = true boolvalue.Value = false repeat message:Play() light.Ambient = Color3.new(150/255,0/255,0/255) alarm:Play() wait(0.2) light.Ambient = Color3.new(0/255,0/255,0/255) wait(0.9) light.Ambient = Color3.new(150/255,0/255,0/255) until boolvalue.Value == true end end
Revising my answer a third time because I made a mistake of putting stuff after the while true do loop lol
Try this and see if it works
local boolvalue = script.Parent.bool local light = game:GetService("Lighting") local alarm = script.Parent.Parent.alarm local message = script.Parent.Parent.corevent local temp = script.Parent.SurfaceGui.Text local function change(v) if (v == false) then repeat message:Play() light.Ambient = Color3.new(150/255,0/255,0/255) alarm:Play() wait(0.2) light.Ambient = Color3.new(0/255,0/255,0/255) wait(0.9) light.Ambient = Color3.new(150/255,0/255,0/255) until boolvalue.Value == true end end boolvalue.Changed:Connect(change) change(boolvalue.Value) while true do wait() if temp.Text == "1999°c" then boolvalue.Value = true alarm.Looped = false elseif temp.Text == "2000°c" then script.Parent.Parent.Map.coremachine.coreOverheat.Fire.Enabled = true alarm.Looped = true boolvalue.Value = false end end
Hey bro, the it works what you did. You did it right and everything but this single line breaks the whole script it's the line 10
FIXED:
local boolvalue = script.Parent.bool local light = game:GetService("Lighting") local alarm = script.Parent.Parent.alarm local message = script.Parent.Parent.corevent local temp = script.Parent.SurfaceGui.Text while true do wait() if temp.Text == "1999°c" then boolvalue.Value = true alarm.Looped = false elseif temp.Text == "2000°c" then script.Parent.Parent.Map.coremachine.coreOverheat.Fire.Enabled = true alarm.Looped = true boolvalue.Value = false repeat message:Play() light.Ambient = Color3.new(150/255,0/255,0/255) alarm:Play() wait(0.2) light.Ambient = Color3.new(0/255,0/255,0/255) wait(0.9) light.Ambient = Color3.new(150/255,0/255,0/255) until boolvalue.Value == true end end
You had it change the value "boolvalue" and it's an object so you can't change it's value, you forgot to add ".Value" to it.
There is a property in every value named "Value". In order to access this property, you must reference it (The Value Property) when talking about the name of the value. Line 10 is where you made the mistake!
For Example:
local bool = game.Workspace:FindFirstChild('BoolValue') if 1+1 == 2 then bool.Value = true wait(2) bool.Value = false end)