Hello!
I am currently wondering how do you run a function by checking if a player has a gamepass and/or badge. Meaning the code will run once if the user has a badge and/or gamepass. If you want a TL; DR, just skip the context part.
Disclaimer: As of writing this I am at school, on the lunch period, so I don’t have access to my computer and I am not always available.
Context
I am currently making a FNAF fan game (not important). Just to get context, in FNAF game you usually have an office.
So basically, the FNAF office, yes it has a desk.
My game isn’t public yet and not finished, one day I’ll make it public temporarily for testing purposes and give a badge to those who tested it. I also have a donation gamepass.
As of right now, if you own the gamepass, objects appear in your office, these are themed after the FNAF character the purple guy. (run by cloning from ServerStorage to workspace):
- A little staue of him is on your desk.
- A little poster of the character is on your wall.
- A letter appears on your desk, opening it will briefly say thanks for donating. (More info as you read more)
Code
Now that I have a gamepass and badge. I want to know how to do something a bit like this:
GamePassOwned = true
BadgeOwned = true
--Imagine it’s a code that checks for ownership of the badge and gamepass
if GamePassOwned or BadgeOwned == true then
--code here
end
TL; DR
So basically I want to know how to check ownership of a badge and gamepass and set variables to true.
How do I go about this.
I’ve tried looking up on the forum and dev hub, but it only gives me (for example the gamepass):
--Identifying MarketPlaceService and the gamepass ID.
--I do not fully remember the code (I’m at school as of writing this).
(A function of when the gamepass is owned)
--Code run by it
end
So if there’s any way to know how I can do this, please let me know.
If there’s any lack of details or confusion, please tell me.
Like I said before, as of writing, I am at school and we’re in the lunch period