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

.Changed or :GetPropertyChangedSignal("Value") not working?

Asked by
Scaii_0 145
5 years ago

So I have a script in workspace, with a value in that script.

local value = script.Value

value.Value = true
value.Value = false

value:GetPropertyChangedSignal("Value"):Connect(function()
    if inGame.Value == false then
    --rest of script
    end
end)

However, the problem is the script never starts.

Is there any reason as to why?

0
You should not be using GetPropertyChangedSignal for a value holder. Use the changed event instead. User#5423 17 — 5y
0
ive tried changed, it didnt work tho Scaii_0 145 — 5y

3 answers

Log in to vote
0
Answered by 5 years ago

try this, tell me what prints. also, are you sure ur changing the value?

local value = script.Value

value.Value = true
value.Value = false
--ingame was never declared, declare it.
value:GetPropertyChangedSignal("Value"):Connect(function()
warn("Value Changed")
    if inGame.Value == false then
    --rest of script
warn("false")
else 
print("true")
    end
end)
0
manually change the bool value EmbeddedHorror 299 — 5y
0
oh and inGame was the value name, sorry about that. Scaii_0 145 — 5y
0
Do not use GetPropertyChangedSignal for this -1 User#5423 17 — 5y
0
nothing is printing Scaii_0 145 — 5y
0
Change the name of the bool, ur doing script.Value EmbeddedHorror 299 — 5y
Ad
Log in to vote
0
Answered by
Scaii_0 145
5 years ago

ok so, you have to put the " = true, = false" AFTER the GetPropertyChanged

Log in to vote
0
Answered by 5 years ago

Also, script.Value is probably not a valid property of a script.. It isn't...

Try

script.Parent.Value 

Instead...., and I hope you're using a value based object like StringValue, IntValue, etc. On those objects, only the Value property can be used with GetPropertyChanged as detailed in the following link of the Roblox documentation.

https://developer.roblox.com/en-us/api-reference/function/Instance/GetPropertyChangedSignal

0
and it assumed your script is a child of the object you're trying to get the "Value" property of. :D JasonTheOwner 391 — 5y

Answer this question