✓ Accepted answer
##Problem
Have you considered using the or operator?
##Solution
- The
or operator tells the script, alright if the first thing is wrong we'll check if this next thing is right. So if the PlayerHasPass returns false, you would have the or operator detect if the player has your name.
##Recommendation
Do not use GamepassService. The issue with GamepassService is it caches the result you initially receive. That means the player will not be able to get game pass items until they join a new server. You should be using MarketplaceService's PlayerOwnsAsset function to get a result.
However, if you do go the MarketplaceService route, you would need to look into the CharacterAdded event and you wouldn't be using StarterGear. I do believe I've heard at one point StarterGear doesn't work as intended in FilteringEnabled settings, however, I am unaware if this issue has been resolved.
##Final Script
The only thing I did change was adding the or operator to the if-then statement and changed the GamepassService to MarketplaceService functions.
id = 484193252
game.Players.PlayerAdded:connect(function(plr)
repeat wait() until plr.Character
if Game:GetService("MarketplaceService"):PlayerOwnsAsset(plr, id) or plr.Name == "OpticUniversse" then
tool = game.ServerStorage["Yellow Neon"]
tool:clone().Parent = plr.Backpack
tool:clone().Parent = plr.StarterGear
end
end)
######Hopefully, this answered your question. If it did, do not forget to hit the accept answer button. If you have any questions, feel free to comment below.