I've been trying to make this pet ability where when the pet is equipped, it gives a certain amount of hearts (the currency) per second.
I have this in leaderstats:
if game.Players.LocalPlayer.PetsEquiped("1").Value == "pet1" then
while true do
game.Players.LocalPlayer.leaderstats.Hearts.Value = game.Players.LocalPlayer.leaderstats.Hearts.Value + 2
wait(1)
end
end
1 is the pet name, pet1 is the value of 1 when the pet becomes a StringValue under the folder called PetsEquiped.
I've tried putting this in its own script under the pet itself, and I've tried doing other similar variations of this where I just change the first line, for example
if game.Players.LocalPlayer.PetsEquiped("1") then
while true do
game.Players.LocalPlayer.leaderstats.Hearts.Value = game.Players.LocalPlayer.leaderstats.Hearts.Value + 2
wait(1)
end
end
Nothing seems to work, so if anyone could at least guide me in a direction as to what I should be doing, that would be helpful, thank you.

4 comments
You might've meant PetsEquiped["1"] if there is a value names 1 inside of pets equipped
Also you should make this a server script since localscripts don't make any changes.on the server meaning the game won't see that you're updating the leaderstats value
I wanna help on discord if that's possible, Lucy#0003
i sent a request, i'm ioZyne