Confused with script

It seems the value of PlrName is nil.

While the game is running, in the explorer check PlrName’s properties and make sure value is not nil.

Yep I made sure it was my name. Any other ideas?

Well the error is saying the string we passed to find the player is nil, so if the value is not nil in the game i’m unsure on what the problem might be here.
When I get home i’ll try to think of a solution to help you.

Get the player by finding the player’s character through the touched event and using GetPlayerFromCharacter.

local Players = game:GetService(“Players”)

button.Touched:Connect(function(hit))
if hit.Parent:FindFirstChild(“Humanoid”) then
local character = hit.Parent
local player = Players:GetPlayerFromCharacter(character)

(Do stuff here)

end
end)
3 Likes