Essentially, I'm making a system where you need to collect 3 orbs to open a door. Once the value reaches 3, the door doesn't change for some reason. (AmountOfOrbs is a NumberValue in workspace)
--SCRIPT FOR THE DOOR-- if game.Workspace.AmountOfOrbs.Value == 3 then game.Workspace.Door.CanCollide = false game.Workspace.Door.Transparency = 0.25 end
(they are in separate scripts in workspace btw)
--SCRIPT FOR THE ORB-- script.Parent.Touched:Connect(function(hit) game.Workspace.AmountOfOrbs.Value +=1 script.Parent:Destroy() end)
The first script doesn't get updated, it only runs once. To make it updated, use the Instance:GetPropertyChangedSignal()
function/event and check if the new value is or more than 3.
workspace:WaitForChild("AmountOfOrbs"):GetPropertyChangedSignal("Value"):Connect(function() local newValue = workspace:WaitForChild("AmountOfOrbs").Value if newValue >= 3 then workspace.Door.CanCollide = false workspace.Door.Transparency = 0.25 end end)