How can I fix this script

Script is simple, however it won’t work.
How can I fix it?
Credit to @Limited_Unique for the script

local players = game:GetService("Players")
local mpService = game:GetService("MarketplaceService")
local gamepassId = 24064532 --change to gamepass id

players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local player = players:GetPlayerFromCharacter(character)
		local gamepassCheck = mpService:UserOwnsGamePassAsync(player.userId, gamepassId)
		
		if gamepassCheck then --user has gamepass
			
			script.Parent.RightEye.Transparency = 0 -- This part I did
			script.Parent.LeftEye.Transparency = 0 -- This part I did
			
		end
	end)
end)

The script is in StarterCharacterScripts

3 Likes

Are the bits you added the things which aren’t working?

1 Like

There is no left and right eye in a character.
What exactly are you trying to do? Did you make a left and right eye?

I added the eyes yes
@Limited_Unique yes

If you have a StarterCharacter rig which contains LeftEye and RightEye parts then parent the script to that rig. As it stands “script.Parent” if the script is directly parented to the StarterPlayerScripts folder will fetch that folder. Whereas if you parent the script to the custom StarterCharacter model “script.Parent” will fetch the model & then “.LeftEye”, “.RightEye” will match the parts with those names.

I did it’s parented to the players rig.

(the startercharacter is the player)

I did exactly that, but it still doesn’t work

Do you see any console errors when playing in studio?

You could try the following instead:

script.Parent:WaitForChild("RightEye").Transparency = 0 -- This part I did
script.Parent:WaitForChild("LeftEye").Transparency = 0 -- This part I did

Nope didn’t work. No errors printed

Any errors in the output? What specifically is not working?

Yes I have tried turning it off then turning it on again

Nothing works at all, I do own the gamepass and like I said no errors

What exactly are you trying to do here?

Make the eyes visible when you buy a gamepass.

sorry for the late reply @Sop8x

I don’t see any problems with this script. Maybe I’ll give it a try.

Edit: I’m in class now so I’m unable to check. Sorry. I’ll give it a check in a bit.

1 Like

are you using a rig that has a LeftEye and RightEye? i think that’s the problem.

Having a rig isn’t a problem. It’d work the same way.

in the script, i see they are referring a property, so i thought they had a rig with left and right eyes.

They actually do have those eyes…

He has a custom rig

Meaning he has a custom rig.