script.Parent.MouseButton1Click:Connect(function()
game:GetService(“MarketplaceService”):PromptGamePassPurchase(game.Players.LocalPlayer,19711172)
end)
** this, the top layer got cut off
script.Parent.MouseButton1Click:Connect(function()
game:GetService(“MarketplaceService”):PromptGamePassPurchase(game.Players.LocalPlayer,19711172)
end)
** this, the top layer got cut off
Where is the tool giver script placed? And also move your coil to ReplicatedStorage.
Tool Giver script (one sent by you) placed in ServerScriptService.
Tools in Server Storage
So it’s a Script, not a LocalScript?
Yeah, standard ‘Script’.
The only local script, is just inside the GUI button.
You should create a LocalScript inside StarterPack with the code and move the coils to ReplicatedStorage.
I’ll try this.
Do I need to adjust ‘local SS = ServerStorage’ to Replicated Storage?
Yes. You can do: local RS = game:GetService(“ReplicatedStorage”)
Unfortunately, no errors and still the tool is not awarded when testing/after purchasing the Game Pass. It just says ‘succeeded’ too after purchasing.
Remove game.Players.PlayerAdded on the LocalScript.
local MarketplaceService = game:GetService('MarketplaceService')
local ReplicatedStorage = game:GetService('ReplicatedStorage') -- I'd suggest placing your tools here instead
local item = ReplicatedStorage:WaitForChild('GravityCoil') -- The name of your tool is here, located in RS
local passId = 19711172
game.Players.PlayerAdded:Connect(function(player)
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, passId) then
local clone = tool:Clone()
clone.Parent = player:FindFirstChild('Backpack')
end
end)
That should work but you put tool instead of item.
local marketPlaceService = game:GetService('MarketPlaceService')
local serverStorage = game:GetService('ServerStorage')
local players = game:GetService('Players')
local gamepassId = 19711172
players.PlayerAdded:Connect(function(player)
local success, hasPass = pcall(function()
return MarketPlaceService:UserOwnsGamePassAsync(player.UserId, gamepassId)
end)
if success then
if hasPass then
serverStorage.Gravitycoil:Clone().Parent = player:WaitForChild('Backpack')
serverStorage.Gravitycoil:Clone().Parent = player:WaitForChild('StarterGear')
end
else
warn(hasPass)
end
end)
Tested, zero errors however the item (Gravity Coil) is not given to me in testing.
I fixed the ‘local item’ and local clone = item:clone() too, but the biggest issue here is the tool (identical name, located in Replicated Storage) is not given after buying.
same here, script inside SSS.
The gravity coil, isnt being given to the player after buying through the gamepass UI… how is this happening?
The reason why your code isn’t working is because whenever the player’s character spawns in, the backpack is cleared. What you’re doing is putting the tool inside the players backpack before the character had been added, making it seem like the tool was never added into the backpack.
To avoid this, you must wait for the character to be added into the game before giving them the tool.
Fix this though? but its the same problem??
The script must be in ServerScriptService
It is in ServerScript Service.
The Giver script is in SSS, the tools are in Server Storage.
I’m lost to why its happening, everything is correct - names, IDS
Is the problem the Local Script within the Image Button (to purchase the gamepass?) the prompt is activated though…
game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer,19711172)
end) ```