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

[SOLVED] Why won't this server Script detect a change in a NumberValue?

Asked by
DesertusX 435 Moderation Voter
2 years ago
Edited 2 years ago

I have a server script that sets 4 NumberValues in Workspace as variables. The NumberValues are initially 0, then are changed with a LocalScript. In game, I see that the NumberValues are not 0 anymore, but if I put a yield on the server script that waits until the NumberValues are changed, it never stops.

Server Script:

local id1 = game.Workspace.MoveId1
local id2 = game.Workspace.MoveId2
local id3 = game.Workspace.MoveId3
local id4 = game.Workspace.MoveId4

repeat wait() until id1.Value ~= 0

print("IDs changed")

Thanks in advance, DesertusX

1 answer

Log in to vote
1
Answered by 2 years ago

I think you should make a function:

id1.Changed:Connect(function()
print("Hello World")
0
Thank you, but it turned out the problem was that the NumberValues were changed in a LocalScript while the other script was server-sided. DesertusX 435 — 2y
Ad

Answer this question