I am making a door function and I want to change a value from the script. In other words, I want the script to make the StringValue a different value from before and have the script do functions based off of the value of the StringValue. Here is what i have so far. "open" is the value that determines if the door is open or not.
local function OnClick(player) script.Parent.Parent.Parent.open.Value = "yes" script.Parent.Parent.Parent.CanCollide = false wait(9.5) script.Parent.Parent.Parent.CanCollide = true end if script.Parent.Parent.Parent.open.Value == "no" then script.Parent.ClickDetector.MouseClick:connect(OnClick) end if script.Parent.Parent.Parent.open.Value == "yes" then script.Parent.Parent.button1.BrickColor.b = 0 script.Parent.Parent.button1.BrickColor.r = 255 script.Parent.Parent.button1.BrickColor.g = 0 wait(2.5) script.Parent.Parent.button1.BrickColor.b = 105 script.Parent.Parent.button1.BrickColor.r = 102 script.Parent.Parent.button1.BrickColor.g = 92 end
The brick color changing is to alert the player that the door is already opened.
How can I make the value change from the script?
Also, I am not sure if this will work as an if then, but that's why I came here.