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
01local Tool = script.Parent.Parent
02local Handle = Tool:WaitForChild("Handle")
03 
04Tool.Equipped:Connect(function(Mouse)  
05local player = game:GetService("Players"):GetPlayerFromCharacter(Mouse.Parent)
06print(player) -- nil
07    Mouse.Button1Down:Connect(function()
08    print(player) -- nil
09        wait(1)    
10    end)
11end)

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

1local player = game.Players:GetPlayerFromCharacter(Tool.Parent)
0
i hope this helped u TNTIsLyfe 152 — 4y
Ad

Answer this question