i am only able to find the player in game.players but i cant find the character in game.Workspace by using my tool
COMMUNITY QUESTION
how do i access a character from a tool?
1 answer
the character can be found two ways. The first way is by using :FindFirstChild()
if game.Players.LocalPlayer then
local plr=game.Workspace:FindFirstChild(game.Players.LocalPlayer)
end
the other way(the one thats better to use) is by using plr.Character
local plr=game.Players.LocalPlayer.Character
also, you could just get the localplayer when the tool is equipped
local tool=script.Parent
local plrcheck=false
local plr
local debounce=false
tool.Equipped:Connect(function()
if plrcheck==false and not debounce then
debounce=true
plr=script.Parent.Parent
wait(0.1)
plrcheck=true
debounce=false
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Note that this only will work in a LocalScript. A Script (running on the server) will have a LocalPlayer of nil.
i know, tools are localized
thats why i added the last one b/c it doesnt need a localscript