Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

.Changed or GetPropertyChangedSignal("Value") doesn't fire?

while wait() do
	if game.ReplicatedStorage.inRound:GetPropertyChangedSignal("Value") == false then
		print("false")
	end
	if game.ReplicatedStorage.inRound:GetPropertyChangedSignal("Value") == true then
		print("true")
	end
end

I've tried other methods as well but they won't fire at all. I've searched other threads as well but I can't find the answer. Any help is appreciated, thanks.

2 answers

✓ Accepted answer

In your above scenario, why don't you just do:

while wait() do
    if game.ReplicatedStorage.inRound.Value == false then
        print("false")
    end
    if game.ReplicatedStorage.inRound.Value == true then
        print("true")
    end
end

Hope it helps

6 comments

0

Thanks for the reply. I tried your code but it doesn't work either. I turned the inRound.Value on and off in the game but it just keeps printing "false".

0

Were you changing the value on and off locally and is the script a server script? If you are changing the value locally (Client side), and the script is on the server's side, it might be printing what the server sees: false.

0

Well I play tested it. The inRound is in the RepStorage, so when I play tested I just turned it off and on. I don't know if that's changing it locally, and yes the it's a server script.

0

Press play/play here, in "Home" or "Test", find "Current: Client", press it and it should say Current: Server. Now try changing the value.

0

Make sure you are changing the value from the Server and not from the client as that won't work. As @ChristianTRPOC said. Play the game and click on, Current: Client. Now it should say Current: Server and now go to Replicated Storage and change the value.

0

Thank you guys so much that was the problem! I just wasnt running from the server!

GetPropertyChangedSignal() isn't being used correctly. The great thing about this is that you don't need a loop at all. This function triggers a watch on a server event, in this case "Value" being changed.

Try this:

game.ReplicatedStorage.inRound:GetPropertyChangedSignal("Value"):Connect(function(Value)
	if Value then
		print("false")
	else
		print("true")
	end
end)

or simply:

game.ReplicatedStorage.inRound:GetPropertyChangedSignal("Value"):Connect(function(Value)
	print(Value)  -- Since Value will automatically be casted into a string
end)

5 comments

0

Your game will also run faster, since you're not running an infinite loop which takes resources

0

Thanks for the reply. I tried this but it unfortunately still doesn't work.

0

Was there any error given? It worked when I tested it. Did you write :Connect(function(Value ... ?

0

yeah thank you! it works the problem was I just wasnt running from the server. I ran it with the client

0

sorry I didn't choose your answer! It definitely made my code a lot more effiecient, though.

This discussion is preserved as it was. New answers, comments, and votes are closed.