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

How to make a tool model gamepass?

Asked by 7 years ago

This is what the tool gamepass is like: When the gamepass is bought, the player that owns it owns a tool model (not ROBLOX gear) in the game.

This is the script that I tried:

if game:GetService('GamePassService'):PlayerHasPass() then
    game.ServerStorage.VoidSword:Clone
end

I know, there are many things wrong but this is my first time making a scripted game.

1 answer

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

**Problem: **

You seemed to not fill in the parameters of the :PlayerHasPass() . I also don't know how you want the script to give the player the tool whether it be upon joining or not so I did that. You also seem to be doing the cloning process wrong.

Solution:

I just added the parameters in their rightful place and added a PlayerAdded event. I fixed your cloning problem.

Code:

local id = 0000000 --Change this to the gamepass id you want

game.Players.PlayerAdded:connect(function(player)
    if Game:GetService("GamePassService"):PlayerHasPass(player, id) then --Added the Parameters 
    local clone =  game.ServerStorage.VoidSword:Clone() -- You need the parenthesis and to determine where it will be parented to
    clone.Parent = player:WaitForChild("Backpack") --In this game the player's Backpack
        print(player.Name .. " has the game pass!")
    else
        print(player.Name .. " doesn't have the game pass...")
    end
end)

If you have questions don't be afraid to ask and I will be glad to answer. If this helped you don't forget to accept my answer.

0
Thanks for the solution! bomblitz06 94 — 7y
0
No problem yougottols1 420 — 7y
0
The script worked when the player joined the game, but when the player dies, the tool doesn't get cloned into the player's inventory again bomblitz06 94 — 7y
0
How do I make the same code except use a different tool? Ezrylius 0 — 5y
Ad

Answer this question