So I am making a game called Lemonade Break and I am working on making a script that will have you purchase items when you click on them, but it wont subtract the money, and I am trying to only make it work if they have 100 currency or more

local ToolNames = {"BetterTool"}
local Storage = game:GetService("ServerStorage")
local currencyy = game.Players.LocalPlayer.leaderstats.LemonsAte

local Part = script.Parent
local ClickDetector = Part:WaitForChild("ClickDetector")

ClickDetector.MouseClick:connect(function(Player)
	if Player and Player.Character and currencyy.Value > 99 then
		local Backpack = Player:WaitForChild("Backpack")
		for i = 1, #ToolNames do
			local Tool = Storage:FindFirstChild(ToolNames[i])
			if Tool then
				currencyy.Value =- 100
					Tool:clone().Parent = Backpack
			end
		end
	end
end)

6 comments

0

Are you getting any errors? If not try changing the ":connect" on line 8 to ":Connect".

0

YOOOOOOOOOO

0

Elaborate. Elaborate. Come on, it shouldn't be hard. Check if the player's currency is 100 or over using >=100, and set their currency. Also, connect is deprecated. Use Connect instead. Capitalize clone.

0

I helped with that but still won't fix the problem.

0

Thank you iNot_here for solving this when DiamondComplex couldnt help at all and was useless

0

Yo stfu pokemon fanboi