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

Is there a way to know which tool the player currently is "Equipping" without using .Equipped ?

Asked by
nanaluk01 247 Moderation Voter
8 years ago

Is there a way to know which tool the player currently is "Equipping" without using .Equipped ?

I have tried a lot of things.

I have searched the wiki too, but without any luck

I am not asking for anyone to create a script for me, I just want to know how I would do this.

Any help is greatly appreciated!

0
why in the world wouldn't you use equipped? Perci1 4988 — 8y
0
I have my reasons. Because I am making a system that "deposits" the tool you're holding, when you click a button. And if I used Equipped, it would deposit when I Equipped the tool, not when I clicked the button. That's why. I have tried implementing the clicked event inside the equipped event, but that did not work. nanaluk01 247 — 8y
0
You didn't specified what .Equipped is from. AFAIK that's an event for tools, so you are saying you have a lot of tools connected to the same function? Just connect them to different functions. cabbler 1942 — 8y

1 answer

Log in to vote
2
Answered by
brianush1 235 Moderation Voter
8 years ago

You could iterate through the player's character, and find any "Tool" instance. Alternatively, you can use "FindFirstChildOfClass" to find the first "Tool" instance, since you cannot equip multiple tools at once. Note that this will not work for the older "HopperBin" tools.

-- The following is untested code
local Player = game.Players.XXXX
local Character = Player.Character
function GetTool()
    return Character:FindFirstChildOfClass("Tool")
end
Ad

Answer this question