game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
if MPS:UserOwnGamePassAsync(plr.UserID, 161641804) then
print(plr.Name .. " owns VIP gamepass.")
local head = char:WaitForChild("Head")
if head then
local button = head.NameTag.NameTag
end
end
end)
end)
Character or Character Head isn’t exist yet when the script run.
That why you got an “Attempt to index nil with ‘Head’”
game.Players.PlayerAdded:Connect(function(plr)
if MPS:UserOwnsGamePassAsync(plr.UserId, 161641804) then
plr.CharacterAdded:Connect(function(chr)
local head = chr:WaitForChild("Head")
local button = head:WaitForChild("NameTag"):WaitForChild("NameTag")
end
end)
end)
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
if MPS:UserOwnGamePassAsync(plr.UserId, 161641804) then
print(plr.Name .. " owns VIP gamepass.")
local head = char:WaitForChild("Head")
if head then
local button = head.NameTag.NameTag
end
end
end)
end)