Can anyone help fix my script I’m trying to make it so when a players currency amount changes a UI will show up on their screen. But I cant quite figure it out
My code is down below:
local player = game.Players.LocalPlayer
player:WaitForChild("leaderstats").Currency.Changed:Connect(function()
if player.leaderstats.Currency.Value.Changed then
script.Parent.LevelUp.Visible = true
wait(5)
script.Parent.LevelUp.Visible = false
end
end
You don’t need the “if player.leaderstats.Currency.Value.Changed”, that will probably just cause an error. Instead just do this:
local player = game.Players.LocalPlayer
player:WaitForChild("leaderstats").Currency.Changed:Connect(function()
script.Parent.LevelUp.Visible = true
wait(5)
script.Parent.LevelUp.Visible = false
end
Actually, it won’t really change. Changed is an RBXScriptSignal object, and the if conditional checks to see if something is not false or nil, so it should work.
local player = game.Players.LocalPlayer
player:WaitForChild("leaderstats").Currency.Changed:Connect(function()
print("running")
script.Parent.LevelUp.Visible = true
wait(5)
script.Parent.LevelUp.Visible = false
end
local player = game.Players.LocalPlayer
player:WaitForChild("leaderstats").Currency.Changed:Connect(function()
script.Parent.Visible = true
wait(5)
script.Parent.Visible = false
end