My friend gave me this, and i put it in the tool script, but when i test it says player is a nil value
local Tool = script.Parent
local Player = game.Players:findFirstChild(Tool.Parent.Name)
My friend gave me this, and i put it in the tool script, but when i test it says player is a nil value
local Tool = script.Parent
local Player = game.Players:findFirstChild(Tool.Parent.Name)
The script running should be a LocalScript.
If the script is a LocalScript, then we can ask for the LocalScript to find the LocalPlayer executing the script.
local PlayerHoldingTheTool = game.Players.LocalPlayer
local PlayerName = PlayerHoldingTheTool.Name
PlayerHoldingTheTool is the LocalPlayer himself. PlayerName is his name.
If this helped, accept the answer! Hope this helped!
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
The first thing that comes to my mind is: Why is the F not capitalized? FindFirstChild needs it to be capitalized.