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

How do I access a tool on a specific person and be able to edit its properties?

Asked by 5 years ago

I'm working on making an ammo box and I wasn't quite sure on how to access the specific person that touched the box in order for me to be able to access the gun that that person is holding and ammo to the IntValue that is a child of the tool. I know that while the tool is equipped, it enters the player's model in the workspace, but I don't know how to get to that character without using the name of the model, which obviously I won't be able to do while the game is running and for every character. I tried making the variable of "player = game.Players.LocalPlayer" in both server and local scripts, but nothing was able to work. I used the .Touched event and connected the function that I made to change the IntValue but had no result at all. --Sorry if I wasn't specific enough or didn't include something important this is my first post :)

1 answer

Log in to vote
0
Answered by
yyyyyy09 246 Moderation Voter
5 years ago

You can use local player = game.Players.LocalPlayer.Character

to get the players character

Ad

Answer this question