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

How to get player from character with tool?

Asked by
14dark14 167
4 years ago
Edited 4 years ago
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

0
If that's a localscript, just use game.Players.LocalPlayer nc2r 117 — 4y
0
bruh ur using :getplayerfromcharacter when it is a mouse, Thats just wow TNTIsLyfe 152 — 4y
0
also the mouse is parented to the player buh TNTIsLyfe 152 — 4y
0
none of this helps, the script isnt local btw 14dark14 167 — 4y

1 answer

Log in to vote
1
Answered by
TNTIsLyfe 152
4 years ago

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)
0
i hope this helped u TNTIsLyfe 152 — 4y
Ad

Answer this question