Tools wont pop up in game or in studio

Im having a bit of trouble in studio with my gamepasses and my gamepass shop. I think it has something to do with the scripting. I put my tools inside of the script which is inside ServerScriptService:


And here is the other script which is located in the ShopFrame:

Everything was working fine, in studio my passes would load when I joined, and now they don’t. Can someone help me? I tried watching some tutorials but none of them seemed to have worked.

2 Likes

It looks all fine are you sure you own the gamepasses

1 Like

Yes I own the gamepasses. Also, the tools are parented to the script in ServerScriptService if that makes a difference:
Screenshot 2023-10-25 at 7.31.01 AM

1 Like

This is an server script right? As there is then no reason to put the item in startergear

EDIT:
Try to remove :waitforchild

1 Like

Yes this script is inside ServerScriptService. I never put the items in startergeat. They are parented to the scirpt that is in ServerScriptService, which is the 1st script I sent

In player’s invertory’s, no statergear to thing exists. Try to remove the startergear thing in script 1.

Okay, then what do I write instead?

i could think of that the gear loads after the script, and then the script doesn’t know where the tools are, i think you should do :WaitForChild(“GamepassNameHere”,math.huge)

which script and how would I write it

in the script with the tools in it and write like this for an example:

[261692723] = script:WaitForChild("Sword",math.huge),

Okay so it sort of worked, when i load into the game, i get 4 of the items. The items I am not getting are the FusionCoil and the Sword. For the fusion coil, for some reason I have to buy it then it will give it to me. But for the sword, it says I already have it owned which is weird.
Screenshot 2023-10-26 at 9.18.19 PM



Do you know how I can fix these issues? I could send the scripts if you want.

Paste the scripts here for us so we can do some experimenting ourselves :+1:

Script in ServerScriptService:

Script in ShopFrame:

i think he means in text not in pictures

How do I send the scripts in text?

copy the part of the script then paste it in here

Script in ServerScriptService:
local gamepassIDs = {
[261692723] = script:WaitForChild(“Sword”,math.huge),
[261687552] = script:WaitForChild(“GravityCoil”,math.huge),
[261514808] = script:WaitForChild(“SpeedCoil”,math.huge),
[261690540] = script:WaitForChild(“FusionCoil”,math.huge),
[261695728] = script:WaitForChild(“tommy gun”,math.huge),
[261697421] = script:WaitForChild(“GrappleHook”,math.huge),
}

local mps = game:GetService(“MarketplaceService”)

game.Players.PlayerAdded:Connect(function(p)

for id, tool in pairs(gamepassIDs) do
	
	if mps:UserOwnsGamePassAsync(p.UserId, id) then
		
		tool:Clone().Parent = p.StarterGear
		tool:Clone().Parent = p.Backpack
	end
end

end)

mps.PromptGamePassPurchaseFinished:Connect(function(p, id, purchased)

if purchased and gamepassIDs[id] then
	
	gamepassIDs[id]:Clone().Parent = p.StarterGear
	gamepassIDs[id]:Clone().Parent = p.Backpack
end

end)

Script in GamepassShopFrame:
local gamepassIDs = {261514808, 261687552, 261690540, 261692763, 261695728, 261697421,}

local mps = game:GetService(“MarketplaceService”)

script.Parent.Visible = false

for i, id in pairs(gamepassIDs) do

local frame = script.GamepassFrame:Clone()

local info = mps:GetProductInfo(id, Enum.InfoType.GamePass)

frame.GamepassName.Text = info.Name
frame.GamepassDescription.Text = info.Description
frame.GamepassPrice.Text = info.PriceInRobux .. " Robux"
frame.GamepassIcon.Image = "rbxassetid://" .. info.IconImageAssetId

if not mps:UserOwnsGamePassAsync(game.Players.LocalPlayer.UserId, id) then
	
	frame.BuyButton.MouseButton1Click:Connect(function()
		
		mps:PromptGamePassPurchase(game.Players.LocalPlayer, id)
	end)
	
else
	
	frame.BuyButton.Text = "Bought"
	frame.BuyButton.BackgroundColor3 = Color3.fromRGB(3, 75, 0)
	frame.BuyButton.UIStroke1.Color = Color3.fromRGB(2, 58, 0)
	frame.BuyButton.UIStroke2.Color = Color3.fromRGB(2, 58, 0)
end

frame.Parent = script.Parent.GamepassScroller

script.Parent.GamepassScroller.CanvasSize = UDim2.new(0, 0, 0, script.Parent.GamepassScroller.UIListLayout.AbsoluteContentSize.Y)

end

I sent the scripts @BoredHelperDEV

The reason some of your items don’t work is because they’re not correctly set up.
The code itself is good, but the IDS are just off.

For example, This is your gamepassIDs table:

local gamepassIDs = {
	[261692723] = script:WaitForChild("Sword		",math.huge),
	[261687552] = script:WaitForChild("GravityCoil	",math.huge),
	[261514808] = script:WaitForChild("SpeedCoil	",math.huge),
	[261690540] = script:WaitForChild("FusionCoil	",math.huge),
	[261695728] = script:WaitForChild("tommy gun	",math.huge),
	[261697421] = script:WaitForChild("GrappleHook	",math.huge),
}

And this is your gamepassIDS table inside your GamepassShopFrame:

local gamepassIDs = {261514808, 261687552, 261690540, 261692763, 261695728, 261697421,}

Notice how the Sword ID (261692723) isn’t even mentioned inside the gamepassIDs table which is located inside the GamepassShopFrame?
And your Fusion Coil ID isn’t a gamepass, its a place, hence why it won’t show up. Make sure your IDS are correctly set up.

The fusion id link: https://roblox.com/library/261690540 – Your ID that you put in for the Fusion coil.

So with that being said, Your code itself is good, but your ids are just off. Make sure to check your IDS one more time and it should work fine :+1:

1 Like

Thank you so much, that was the issue why it wasn’t working!