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

How would I check if player is currently holding a gun? via distance?

Asked by
Xl5Xl5 65
9 years ago

How would I go about, or start off? I am not asking for a script just a way of doing it?

Checks from a certain radius of a brick, say.. 5 studs or something. Checks if player has Gun selected and the player is currently holding it, if the player is holding a Gun within the radius of the brick then make GUI from the brick Visible.

I am not sure if that made alot of sense... to people heres an example; I walk towards a brick within 5 stud radius, I select my Gun, then a the GUI is visible.

How would I start? I don't really know anything about distance..

1 answer

Log in to vote
0
Answered by
Ryzox 220 Moderation Voter
9 years ago

Use magnitude to find if anyone is within the specific distance

You can also check for the specific tool name inside the players character by looping through everything in their character and checking if the tool is there because when a tool is selected it is parented to your Character.

0
How would I do the check? Xl5Xl5 65 — 9y
0
Create a function that gets all players in the server and checks if they are 5 studs or closer away from the brick using magnitude, then return those players in a table, then do a repeat wait or a loop (however you wish to do it) and make it wait until the amount of numbers in that table that is returned is greater than or equal to 1 (or just greater than 0) then you can do the Gui pop up stuff. Ryzox 220 — 9y
Ad

Answer this question