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

How to buy and receive a gear in game?

I'm trying to make it so that if you have 30 or more cash, the player can click an image button and receive a gear, however, when I test it out, nothing happens when I try to click on the image button even though I have 50 points. Where am I going wrong? (This is a LocalScript)

local plr = game.Players.LocalPlayer
local replicatedstorage = game:GetService("ReplicatedStorage")
script.Parent.MouseButton1Click:connect(function()
	if plr.leaderstats.Points.Value>=30 then
	replicatedstorage.BloxyCola:Clone().Parent=plr.Backpack
	replicatedstorage.BloxyCola:Clone().Parent=plr.StarterGear
	end
	
	
end)

1 answer

Hello there! I'm BlackOrange and I will be helping!

Ok, I'm not exactly sure what is wrong with your code BUT! I will give you a code I write right now and you can test it.

Please do note that I came up on spot and errors can occur.

To check if there is any error with your code, you can go to:

View Tab > Output

from there it will give you red text (if there is a problem)

anyway:

local plr = game.Players.LocalPlayer
local BloxyCola = game:GetService('ReplicatedStorage'):WaitForChild('BloxyCola')

script.Parent.MouseButton1Down:Connect(function()
	local CBC = BloxyCola:Clone()
	CBC.Parent = plr.Backpack -- I haven't check if it is .Backpack or .BackPack switch if doesn't work
end)

This should do the trick.

Well, hopefully this helped you some sort of way.

Best of Luck

-- BlackOrange3343

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