Headless Head Gamepass

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)

I did some testing, it works in studio but not in-game

where is the script?

And what does it look like?

The script is listed in my post and the script is in the workspace. The script works as it should in studio play mode but not in game play mode

Is it local or not?

I think might want to move it to ServerScriptStorage.

Its not a Localscript is just a normal script

Yeah then move it to

Then I believe it should work.

Just tried it in SSS in studio it works but still dont work ingame. This is a screenshot of what it says in-game console:


https://gyazo.com/16228fb4e7d93548001fb224af4b7564

Try making the face and head transparent to 1 instead of deleting them

playerHead.Transparency = 1

playerHead.face:Destroy()

This is aint it?

there try to put player.Character.Head instead

Head is parented to Character not to the player

Before the part that checks if the player has the product, add player.CharacterAdded:Connect(function(char)

After you did so, set playerHead variable value to char:WaitForChild(“Head”). That should fix it

just tried it makes it now work at all not in studio or game

idk what that means or what to do im not a scripter

Its a varaible in the script.

Make sure that the Player,Name is upercase like

(Player.Name)

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)```

alright gimme a second let me go try and see if that fix works

try this idk if this will work as im not in studio

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?!