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

How do I get this script to also give the gamepass tools when a player respawns?

Asked by 6 years ago

So I have this script for gamepasses, (Yes its a new one using MarketplaceService:UserOwnsGamePassAsync) It works except for when a player resets or gets respawned, it gives it to them, once, never again, how can I make it give the tool every time said player's character respawns? Heres the script.

01local MarketplaceService = game:GetService("MarketplaceService")
02local Players = game:GetService("Players")
03 
04local gamePassID = 4468725  -- Put your ID here
05 
06local function onPlayerAdded(player)
07 
08 
09    local hasPass = false
10 
11    local success, message = pcall(function()
12        hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID)
13    end)
14 
15    -- If there's an error, issue a warning and exit the function
View all 39 lines...

1 answer

Log in to vote
0
Answered by 6 years ago

1st up: Add

1--Script Made by Vissequ

at the bottom.

2nd: in the "if hasPass" event (Line 23) try this:

1player.Character.CharacterAdded:Connect(function(character)
2game.ReplicatedStorage.Tools.YourToolNameHere:Clone().Parent = game.Players.LocalPlayer.Backpack
0
Well, uh, I contacted a few people on this at line 30, theres a typo, the script already had that function O.o ResoluteAyres 6 — 6y
Ad

Answer this question