Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to get player from character with tool?

local Tool = script.Parent.Parent
local Handle = Tool:WaitForChild("Handle")

Tool.Equipped:Connect(function(Mouse)	
local player = game:GetService("Players"):GetPlayerFromCharacter(Mouse.Parent)
print(player) -- nil
    Mouse.Button1Down:Connect(function()
	print(player) -- nil
		wait(1)		
    end)
end)

doesnt work

4 comments

0

If that's a localscript, just use game.Players.LocalPlayer

0

bruh ur using :getplayerfromcharacter when it is a mouse, Thats just wow

0

also the mouse is parented to the player buh

0

none of this helps, the script isnt local btw

1 answer

✓ Accepted answer

Whenever you are equpping a tool tthe tool appears in ur character model so if u want the player then u will have to put this line

local player = game.Players:GetPlayerFromCharacter(Tool.Parent)

1 comment

0

i hope this helped u

This discussion is preserved as it was. New answers, comments, and votes are closed.