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:

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

1 answer

Log in to vote
0
Answered by 2 years ago

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)
0
do you still need help or did you solve it yourself? ohhophophoplikebunny 25 — 2y
Ad

Answer this question