I have a door type wall set to detect if an npc is in the current location, when the server first starts the door is open, but when I change the value to something else through console the door wont close. How do I fix this?
my code:
if game.Workspace.NPCs.Collector.CurrentWell.Value == "Beach" then wait(20) script.Parent.Transparency = 1 script.Parent.CanCollide = false else script.Parent.Transparency = 0 script.Parent.CanCollide = true end
The solution is the changed function.
well = game.Workspace.NPCs.Collector.CurrentWell well.Changed:Connect(function() if well.Value == "Beach" then script.Parent.Transparency = 1 script.Parent.CanCollide = false else script.Parent.Transparency = 0 script.Parent.CanCollide = true end end)