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

Can anyone explain to me how I can create a nocol weapon giver using gamepasses?

Asked by 6 years ago
Edited 6 years ago

Alright, basically a majority of the day I was searching for a scripter who can possibly design and intricate script that has to do with the following:

Step 1) Someone buys a gamepass for a gun (a nocollider gun) Step 2) They get in the game Step 3) The player receives the following gun they bought.

Now, it seems like a simple task to use just any ordinary gamepass item giver, but nocol's scripts interfere with average stuff like that.

I've gotten tired of wandering endlessly through Group Recruit Plaza and decided to my request and turn it into a question. All I need is tips or someone who can aid me in creating this script.

Examples of gamepasses that give nocollider weapons. Look in their gamepass store and you will see them.

https://www.roblox.com/games/1016707844/Camp-Tannhauser

https://www.roblox.com/games/425514291/Fort-Bragg-1941#!/store

Thank you for any help, or at least recognizing my question.

For an example of the standard script that Im using for gamepass tools~ Note that this is the script that will not give any nocol weapons specifically, but will give other items for reasons I have yet to find out.

__

Screenshot link:

https://gyazo.com/9ef6f25d57b62301cb0ae2b6269da3de

__

I used the print of "respawned" or "Its a player!" for uses for knowing if the script works and recognizes gamepasses or not.

1 answer

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

It would be actually quite easy. To sell the gamepass Make the gamepass then copy down the id and insert a script into ServerScriptService. The copy the following code in:

local passid = 12345 -- Put the id of your gamepass here

game.Players.PlayerAdded:connect(function(player)
    game:GetService("MarketplaceService"):PromptPurchase(player, passid)
end)

To give gun directly after purchase Personally what you would want to do first is to put your gun into ServerStorage Insert the following script into the script we have created:

game:GetService("MarketplaceService").PromptPurchaseFinished:connect(function(player,id,ifPurchased)
    if ifPurchased then --If something was brought
        if assetId == passid then --If they bought your gamepasss
            local gun = game.ServerStorage.Gun:Clone() --game.ServerStorage.Gun can be changed to wherever you stored your gun
            gun.Parent = player.Backpack
        end
    end
end)

To give the gun if someone brought it before they were in-game Make sure to copy the id down as you will need it Insert the following script into the script we were working on:

game.Players.PlayerAdded:connect(function(player)
    if game:GetService("GamePassService"):PlayerHasPass(player, passid) then
        local gun = game.ServerStorage.Gun -- This should route to wherever you put the gun
        gun.Parent = player.Backpack
    end
end)

Final Script

local passid = 12345 -- Put the id of your gamepass here

game.Players.PlayerAdded:connect(function(player)
    game:GetService("MarketplaceService"):PromptPurchase(player, passid)
end)

game:GetService("MarketplaceService").PromptPurchaseFinished:connect(function(player,id,ifPurchased)
    if ifPurchased then --If something was brought
        if assetId == passid then --If they bought your gamepasss
            local gun = game.ServerStorage.Gun:Clone() --game.ServerStorage.Gun can be changed to wherever you stored your gun
            gun.Parent = player.Backpack
        end
    end
end)

game.Players.PlayerAdded:connect(function(player)
    if game:GetService("GamePassService"):PlayerHasPass(player, passid) then
        local gun = game.ServerStorage.Gun -- This should route to wherever you put the gun
        gun.Parent = player.Backpack
    end
end)

If there are any errors then please tell me :D

0
Question, for the script to work must I have to name the tool "Gun"? TitaneumCat 24 — 6y
Ad

Answer this question