Well I am trying to fix and clean a Shop GUI, I am making it so when you have the bought gear in your Backpack/StarterGear then it wont let you buy it.

Here is the LocalScript:

local price = script.Parent.Parent.Price
local tools = game.ReplicatedStorage:WaitForChild("Tools")
local tool = script.Parent.Parent.ItemName
local player = script.Parent.Parent.Parent.Parent.Parent.Parent

script.Parent.MouseButton1Click:connect(function()
	if not player.StarterGear:FindFirstChild(tool) and not player.Backpack:FindFirstChild(tool) then
		if player.leaderstats:FindFirstChild("Points").Value >= price.Value then
			script.Parent.Parent.Parent.Bought:Play()
			player.leaderstats:FindFirstChild("Points").Value = player.leaderstats:FindFirstChild("Points").Value - price.Value
			game.ReplicatedStorage.ShopBuy:FireServer(tool.Value) --Fires server
		else
			script.Parent.Parent.Parent.No:Play()
		end
	else
		script.Parent.Parent.Parent.No:Play()
	end
end)

Here is the Problem, everything works fine but when you buy the gear, it seems to skip the clone detection system and put the same gear in the backpack

2 comments

0

i'm guessing your itemname is a stringvalue? if so then you're using just tool, not tool.Value so therefore it isn't actually checking

0

ooohhh