So pretty much I want the player to get the gamepass weapon after they died and respawn they recieve it again. Here is the code I have so far. So under StarterGUI and then under ScreenGUI I added image button then a Local Script as follows:
script.Parent.MouseButton1Click:Connect(function() game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer,17070852) end)
The code above is supposed to make a image button and then if the player clicks on it they get a prompt to buy the gamepass weapon. So then in order for them to recieve the gamepass item. I added some other stuff. Under StarterGUI I added a Local Script that says:
local player = game.Players.LocalPlayer local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,17070852) if ownsGamepass then local Launcher = game:GetService("ReplicatedStorage"):WaitForChild("Launcher"):Clone() Launcher.Parent = player.Backpack end
So this is supposed to give the player the gamepass weapon but the thing is every time they die and respawn they lose the weapon. I want to make it so every time they respawn they receive the gamepass weapon again... Can someone make a script or edit this script for me? Or at least help me do so?
Very much appreciated!
whenever someone's character is added, check if they have the gamepass, and give it to them if they do (in a server script)
game:GetService("Players").PlayerAdded:Connect(function(player) -- player joins the game for the first time player.CharacterAdded:Connect(function(character) -- whenever the player spawns or respawns, this is fired local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,17070852) if ownsGamepass then local Launcher = game:GetService("ReplicatedStorage"):WaitForChild("Launcher"):Clone() Launcher.Parent = player.Backpack end end) end)