Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Giving someone a game-pass from the script?

Asked by 6 years ago
1*How do I give my Co-Owner ("Team create person") a game-pass without them buying it?

I tried this:*

01permission = { "PLAYERS NAME HERE" } -- My buddy's name
02 
03 
04 
05local function WaitForChild(parent, childName)
06    assert(parent, "ERROR: WaitForChild: parent is nil")
07    while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
08    return parent[childName]
09end
10 
11 
12 
13local GamePassService = game:GetService('MarketplaceService')
14local PlayersService = game:GetService('Players')
15 
View all 68 lines...

I need help!``

0
You could just do an or player.Name == on line 45 if you're only going to use this for 1 person, theres no point making a table. DinozCreates 1070 — 6y

1 answer

Log in to vote
2
Answered by 6 years ago
Edited 6 years ago

On line 45, you can add your friends name to the if statement. Here's what I mean:

1if GamePassService:UserOwnsGamePassAsync(player.userId, GamePassIdObject.Value) or player.Name == "NameHere" then
2    TeleportToOtherSide(player.Character, otherPart)
3end

However, using a player's name isn't the best thing to do because players can change their name and it'd no longer work. Instead, you can use their UserID:

1if GamePassService:UserOwnsGamePassAsync(player.userId, GamePassIdObject.Value) or player.UserId == 12345 then
2    TeleportToOtherSide(player.Character, otherPart)
3end

There are other ways to do this, I'd just thought that this would be the easiest way for you. Also, you should use tab to indent your scripts instead of space. One more thing, make sure to use :Connect() instead of :connect() which is deprecated.

0
Thanks for doing what i was too lazy to do. DinozCreates 1070 — 6y
0
player.UserId takes in a integer not a string User#23365 30 — 6y
0
Thank you everyone : ) xXnutcrakerXx -10 — 6y
0
My bad, missed that. Fixed Crazycat4360 115 — 6y
View all comments (3 more)
0
xd i had it wrong xXnutcrakerXx -10 — 6y
0
Wait, is "or" (inside the script you gave me) part of the script or not?. xXnutcrakerXx -10 — 6y
0
can you please send me the full script? xXnutcrakerXx -10 — 6y
Ad

Answer this question