Search code examples
luaroblox

Why is this script not working as it should?


Im trying to do a script that prints a NumValue's Value everytime it changes.

i tried:

local Shards = workspace.ads.Amarelo.Shards
local ShardsValue = workspace.ads.Amarelo.Shards.Value
local plr = game.Players.LocalPlayer

function update()
local newValue = ShardsValue
print(newValue)

end
update()

Shards.Changed:Connect(function()
update()
end)

but it just keeps printing me 0 even though the value is another number


Solution

  • Try changing the connect function to something like, see if it will print the new values.

    Shards.Changed:Connect(function(newValue)
    print(newValue)
    end)