01 | local GamepassService = game:GetService( "GamePassService" ) |
02 | local ss = game:GetService( "ReplicatedStorage" ).Tools |
03 |
04 | game.Players.PlayerAdded:Connect( function (player) |
05 | if GamepassService:PlayerHasPass(player, 4982143 ) then |
06 | local Boom = ss:FindFirstChild( "Radio" ) |
07 | Boom:Clone().Parent = player:WaitForChild( "StarterGear" ) |
08 | if not player:WaitForChild( "Backpack" ):FindFirstChild(Boom.Name) then |
09 | Boom:Clone().Parent = player:WaitForChild( "Backpack" ) |
10 | end |
11 | warn( "Gave Radio To " ..player.Name) |
12 | end |
13 | end ) |
Hello, Professional_Lua!
Try this: (I'm testing...)
01 | local GamepassService = game:GetService( "GamePassService" ) |
02 | local ss = game:GetService( "ReplicatedStorage" ).Tools |
03 |
04 | game.Players.PlayerAdded:Connect( function (player) |
05 | player.CharacterAdded:Connect( function (char) --Add this to give the tool every time player dies... |
06 | if GamepassService:PlayerHasPass(player, 4982143 ) then |
07 | local Boom = ss:FindFirstChild( "Radio" ) |
08 | Boom:Clone().Parent = player:WaitForChild( "Backpack" ) --Players don't have starter gear... |
09 | warn( "Gave Radio To " ..player.Name) |
10 | end |
11 | end ) |
12 | end ) |
Good Luck with your games
Hi! Roblox replaced the GamePassService with Marketplace Service. Try using this:
01 | local MarketplaceService = game:GetService( "MarketplaceService" ) |
02 | local Players = game:GetService( "Players" ) |
03 |
04 | local GamePassID = 000000 |
05 |
06 | function onPlayerSpawned(player) |
07 |
08 | local hasPass = false |
09 |
10 | local success, message = pcall ( function () |
11 | hasPass = MarketplaceService:UserOwnsGamePassAsync(player.userId, GamePassID) |
12 | print ( "Player already has Radio" ) |
13 | end ) |
14 |
15 | if not success then |
Change the 00000 to the gamepass ID and change the "Item Name" to the name of the radio and store the item in Lighting! Hope this helps! -tawk1215