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

How do I make a gamepass that gives random gear on spawn?

Asked by 4 years ago

I've been trying to make a game pass for my game that on spawn, you would get a different piece of gear. I have been looking at different tutorials and websites, but none of them told me how to add a game pass that gives random gear on spawn. Can you please help me?

0
Well, maybe if there was an attempt script, then maybe more people will help, this has a risk of being deleted for not "being constructive" CrazyCats84 154 — 4y
0
Here is a script that I am using. It gives specific tools. I am still new to scripting, so I don't know how to make the gear switch on spawn. TheRageObby 0 — 4y
0
game.Players.PlayerAdded:connect(function(player) local mkps = game:GetService("MarketplaceService") local ss = game.ServerStorage repeat wait(0.1) until player.Backpack repeat wait(0.1) until player.StarterGear if mkps:UserOwnsGamePassAsync(player.UserId, GAMEPASSID) then ss.Sword:Clone().Parent = player.Backpack ss.Sword:Clone().Parent = player.StarterGear end end) TheRageObby 0 — 4y

1 answer

Log in to vote
0
Answered by
MediaHQ 53
4 years ago

Create a folder in ServerStorage called Tools, put the tools you would like to give to a player, then make a script in the workspace and put this in it

01local MarketPlaceService = game:GetService("MarketplaceService") --Getting marketplaceservice
02local players = game:GetService("Players") --Getting the players
03local tools = game.ServerStorage.Tools:GetChildren --Getting the tools
04if tools.nil == true then
05    local newfolder = Instance.new("Folder",ServerStorage)
06    newfolder.Parent = game.ServerStorage
07    newfolder.Name = "Tools" --Creates the folder for you if you don't have it :)
08end
09 
10local gamepassid = "PUTGAMEPASSIDHERE" --Replace PUTGAMEPASSIDHERE with your gamepass id
11 
12function spawned(player)
13 
14    local HasGamepass = false --Says you don't have the gamepass
15 
View all 38 lines...

Also, scripting helpers is for help with code, not request code. Let me know if this works!

0
Thank you for trying @MediaHQ , but this code does not work! TheRageObby 0 — 4y
Ad

Answer this question