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

Save tools player had after death?

Asked by
otto045 41
6 years ago

Hello, I have this buy system where a player can buy guns for his money. But I have a problem, when he dies he no longer has the weapons, and he needs to buy new weapons. So I have tried coding a thing that checks if the player has the tool. If he does not have the tool, then it gives him a new one. But I have no way of checking if the player has the tool.

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

Make two tools, one for the player's Backpack object and one for the player's StarterGear object.

Inside a player object, there are two objects you can use: Backpack and StarterGear.

What I would do would be something like this:

local backpackWeapon = toolWeapon:Clone()
backpackWeapon.Parent = player.Backpack
local starterGearWeapon = toolWeapon:Clone()
starterGearWeapon.Parent = player.StarterGear

If done correctly, the player should get the weapon when they buy it and also have it when they respawn after dying.

Bye!

1
Thanks so much! otto045 41 — 6y
0
Happy to help! :) Fireorius 51 — 6y
Ad

Answer this question