Which one? The edited one I sent you, or the one you originally had?
The script one I originally had.
Alrighty then
You should never use a LocalScript to handle gamepasses, it is so easy for an exploiter to replicate what it does and not have to pay anything for the Gamepass.
It is much more sensible to create a script in ServerScriptService.
For example:
function onPlayerAdded(Player)
if Player.UserId == game.CreatorId and MarketplaceService:UserOwnsGamePassAsync(Player.UserId,gamepassId) then
-- run code
end
end
game:GetService("Players").PlayerAdded:Connect(onPlayerAdded)