Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

brick properties wont change after stringvalue changed?

Asked by 2 years ago

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:

1if game.Workspace.NPCs.Collector.CurrentWell.Value == "Beach" then
2    wait(20)
3    script.Parent.Transparency = 1
4    script.Parent.CanCollide = false
5else
6    script.Parent.Transparency = 0
7    script.Parent.CanCollide = true
8end

1 answer

Log in to vote
0
Answered by 2 years ago

The solution is the changed function.

01well = game.Workspace.NPCs.Collector.CurrentWell
02well.Changed:Connect(function()
03if well.Value == "Beach" then
04        script.Parent.Transparency = 1
05    script.Parent.CanCollide = false
06else
07    script.Parent.Transparency = 0
08    script.Parent.CanCollide = true
09    end
10    end)
0
do you still need help or did you solve it yourself? ohhophophoplikebunny 25 — 2y
Ad

Answer this question