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

Quick question... how do I define the tool that a character has equipped?

Asked by 5 years ago

I am trying to access some tools that have different names but the child, which is an IntValue, has the same name in all of the tools. I am able to access the specific tool by using "game.Players.LocalPlayer.Character.'ToolName'" but I need to be able to get that tool without using the name. Thank you :)

0
Like, a server script outside of the tool or a script inside of it? Aresko 53 — 5y
0
The script is outside of the tool, yes toastedtoast224 26 — 5y

1 answer

Log in to vote
0
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
5 years ago

You can use FindFirstChildOfClass() to find any Tool instance under the Character.

local tool = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Tool")
if tool then
    --do stuff
end
Ad

Answer this question