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

How do I make this pet ability script function?

Asked by 4 years ago

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.

0
You might've meant PetsEquiped["1"] if there is a value names 1 inside of pets equipped royaltoe 5144 — 4y
0
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  royaltoe 5144 — 4y
0
I wanna help on discord if that's possible, Lucy#0003 royaltoe 5144 — 4y
0
i sent a request, i'm ioZyne aloevia 2 — 4y

Answer this question