Hello, I'm trying to see if the level has changed somehow, and below is the only one I can think of and it doesn't work. Any ideas to fix this script or a new script to do this? (The script is in the LocalPlayer and the 'stats' is in the player)
while true do local old_level = game.Players.LocalPlayer:FindFirstChild("stats").Level wait(.1) local current_level = game.Players.LocalPlayer:FindFirstChild("stats").Level if current_level.Value > old_level.Value then print("worked") script.Parent.Display.Visible = true return end end
Use the changed event.
local player = game.Players.LocalPlayer local value = player:FindFirstChild("stats").Level value.Changed:Connect(function(property) print(property) end)
It's worth noting this doesn't work with properties, only the actual value/instance.
Try this.
local player = game.Players.LocalPlayer local value = player:FindFirstChild("stats").Level local value2 = value.Value value.Changed:Connect(function() if value2 ~= player:FindFirstChild("stats").Level.Value then local NewValue = player:FindFirstChild("stats").Level.Value print("The old value "..value2.." has changed to ".. NewValue) end end)