Hello, I am still fairly new to scripting and was looking online about how to check if players have a game pass when they join, I got that working. However, I am creating a tycoon map and one of the tycoon buttons require a VIP pass, I need to check if the person touching the button has a vip pass and if they do I need to change a stored string value to "true". The script I currently am having issues with is below.
Script with errors.
local gamePassId = 445136135
function vip(player)
game:GetService("GamePassService")
bool PlayerHasPass ( Player player, int gamePassId )
print(player.Name .. " has the game pass!")
script.Parent.Parent.Parent.VIP.Value = "true"
print(player.Name .. " doesn't have the game pass...")
end
end
vipbutton = script.Parent.Head
vipbutton.Touched:connect(vip)
My Boolean function isn't working, I'm sure to your guy's more experienced eyes, you see some noob mistake. The Boolean function is quite literally copy/pasted from the wiki on handling game passes, The Boolean wants an equals sign. The wiki says that the function depending if true will return a true for PlayerHasPass. I'm not sure what I'm doing wrong, since I'm new, I usually just mash code together until it works properly, so far that has been a semi success.
Thanks in advance, the wiki page also has this:
void
SetPlayerHasPassUrl ( string playerHasPassUrl ) [LocalUserSecurity]
To my understanding, the above code isn't needed for what I'm trying to achieve.
Thanks again
-That one noob nobody likes.

6 comments
Thanks a bunch, that is clever.
I still get an error, 00:12:24.171 - Not a valid Player .Technology Data Entertainment.Buttons.10% Chance for VIP lucky blocks, all droppers. - [VIP].Script', Line 5 at first I thought I was because I was in the editor, but I published and went to my game only to find out it still didn't work. I have the game pass since I made it.
I ran a server test, but when I walked over the button, nothing happened. It didnt give any errors or print anything, this is weird...
When in a roblox server, the button works proeprly, but it doesnt seem to be applying the script. Is there a way I can debug in that mode?
Its most likely an error on my side, I can't seem to figure out what would be wrong, since everytime a button I have is clicked to spawn blocks, it checks if the VIP value has changed and if it is = to "true" then it spawns a vip block. I even manually set the vip value to "true" and the game worked fine in Roblox Studio
I'm sure at your end it is fine, I'll ask a new question.