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

Where to put Number Values Inside a Player to be Accessed from Scripts in a Tool?

Asked by 6 years ago

I made a shotgun. It has a number value inside the shotgun which is the ammo. The shotgun has ammo, and ammopool. I want ammopool to be increased when a player clicks a part in workspace. However, I wish for ammopool to be inside the player so even if the player drops the tool or switches tool the ammopool will stay with the player. I just need to know where would I put the Number Value and how would I reach it inside a script? Thank you!

0
Just anywhere in the player, absolutely anywhere is perfectly fine, as long as you make sure that it can stay there. theCJarmy7 1293 — 6y

1 answer

Log in to vote
1
Answered by
theCJarmy7 1293 Moderation Voter
6 years ago
Edited 6 years ago

Personally, I would recommend the player. If you're using a localScript (and you should be) you can just do game.Player.LocalPlayer:FindFirstChild("Ammo") you could also put it inside the player backpack, and use a series of script.Parent's to get to it, but in my opinion, the former looks nicer.

As for using a ServerScript, don't, because you seem to be trying to get player input.

0
I know I need to put it in the player, but like exactly where? starterPlayer? TheFierceWaffle 64 — 6y
Ad

Answer this question