Script not working

Hey, so i was seeing the eppobot’s tutorial on gamepasses but when i tried to make it didn’t work
could you help me?

Script inside statergui:

local player = game.Players.LocalPlayer
local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,9471122)

if ownsGamepass then
 local sword = game:GetService("ReplicatedStorage"):WaitForChild("Tool"):Clone()
 sword.Parent = player.Backpack
end

Script inside textbutton:

script.Parent.MouseButton1Click:Connect(function()

game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer,9471122)

end)

Did you check the console? If it printed anything, send a screenshot.

It printed nothing what it could be?

Are the scripts inside a normal script or a local script?

Local script* my bad. (30 chars)

They are local scripts (30 chars)

Ill check it out in studio, ill inform you as soon as done! :smiley:

May i ask a question, which script doesn’t exactly work?

Oh and the first script is inside starter gui and the second inside startergui/screengui/textbutton

Don’t you need to have a server script to put tools inside the player? Since others won’t see the tool I believe.

Move the first(server script one that has no player in its icon) script to ServerScriptService. And also it might be when you buy it server already checked if it was bought or not.

Moved to serverscriptservice, still nothing

Local scripts do not work in ServerScriptService.

There are a lot of things that you could of done better but, I don’t think it’s working because you didn’t even purchase the game pass yet. The script will check it before you purchased it, so add a wait .

It’s a local script, localscripts only work on the player and are only replicated on the client itself, so others won’t see it. Convert it to a server script.

I converted to normal script and still nothing

This person made a great tutorial on checking if a user has a gamepass, and giving them the specific tool!

Check it out! :wink:

Link: here

1 Like