I have a shop and it works fine but I want to change that when someone buys a tool, they cannot buy that tool again as long as they have that tool.
Here is the script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("BuyTool")
local function buyTool(player, tool)
if player.leaderstats["????"].Value >= tool.Price.Value then
player.leaderstats["????"].Value = player.leaderstats["????"].Value - tool.Price.Value
local giveTool = ReplicatedStorage.ShopItems[tool.Name]:Clone()
giveTool.Parent = player.Backpack
local giveTool = ReplicatedStorage.ShopItems[tool.Name]:Clone()
giveTool.Parent = player.StarterGear
end
end
remoteEvent.OnServerEvent:Connect(buyTool)

4 comments
if (Player.StarterGrear:FindFirstChild(Tool.Name)) then return end
In what line do I put that?
????
Nvm, Its at the beggining of the function, Thanks!