Hello there, I need some help figuring out why this is not working I am not a scripter nor do I know how to script this script was made by someone I know as there helping me do some of the scripting my game.
game.Players.PlayerAdded:connect(function(player)
if game:GetService('MarketplaceService'):UserOwnsGamePassAsync(player.UserId, 15880440)then
local playerHead = game.Workspace:FindFirstChild(player.Name).Head
wait(.1)
playerHead.Transparency = 1
playerHead.face:Destroy()
print(player.Name..'s head has been removed... they have the gamepass!')
else
local gamepass = 15880440
return gamepass
end
end)
if game:GetService('MarketplaceService'):UserOwnsGamePassAsync(player.UserId, 15880440)then
local playerHead = game.Workspace:FindFirstChild(player.Character).Head
wait(.1)
playerHead.Transparency = 1
playerHead.face:Destroy()
print(player.Name..'s head has been removed... they have the gamepass!')
else
local gamepass = 15880440
return gamepass
end
end)```
Just saying, I see a lot wrong with this script. There are many bad practices here, that I won’t even message. As with your problem, don’t delete the player’s head, just set it transparent. Also make sure the code is hooked up to a player.CharacterAdded event, so when they respawn it works as well. Also, you can just do player.Character to get the player’s character. Also, UserOwnsGamepass can error, so wrap it in a pcall. And, don’t add random wait()s to your script, it’s bad practice. And finally, instead of doing game.Workspace, it is faster to literally write “workspace”. Also, enable line indenting, what are you doing man?!