Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

MarketPlaceService along with dialogs not working correctly?

I feel a bit dumb for asking this, as I am pretty advanced in scripting in lua.. It's just as I been playing Minecraft coding in Java I completely just went dead, any help?

--// Weapons

-- Not using the strings used for the ID's

local Glock17 = 30474685
local M14 = 30474688
local M24 = 30474675
local M4A1 = 30474667
local Peacekeeper = 30474695

--// Services needed

-- Not using the string used for the service

local MarketPlaceService = game:GetService("MarketPlaceService")

--// Script, do not edit anything below this line

script.Parent.DialogChoiceSelected:connect(function(Player, Weapon)
	if (Weapon == script.Parent.Glock17) then
		game:GetService("MarketPlaceService"):PromptPurchase(Player, 30474685)
		
		
	end
end)

4 comments

0

Shouldn't line 20 be "if (Weapon == Glock17) then"?

0

Well, Glock17 is the ID, and I just put that there to keep notes.

0

Weapon == script.Parent.Glock17 asked the script if Weapon is exactly the same instance as script.Parent.Glock17, not if they are identical, but rather if they are the same thing

0

I'm confused, honestly...

1 answer

--// Weapons

-- Not using the strings used for the ID's

local Glock17 = 30474685
local M14 = 30474688
local M24 = 30474675
local M4A1 = 30474667
local Peacekeeper = 30474695

--// Services needed

-- Not using the string used for the service

local MarketPlaceService = game:GetService("MarketPlaceService")

--// Script, do not edit anything below this line

script.Parent.DialogChoiceSelected:connect(function(Player, Weapon)
    if (Weapon == "Glock17" then
        game:GetService("MarketPlaceService"):PromptPurchase(Player, 30474685)


    end
end)

I think this should work; enjoy :)

This discussion is preserved as it was. New answers, comments, and votes are closed.