So im scripting a tools shop and one item in my shop stands out. It is night vision, when the player buys it and equips it the tool will destroy. but that means the player can buy the same tool and do it again heres a clip
local Event = game.ReplicatedStorage.OtherRemotes.Buy
local Allowed = false
local Accessorys = {
"NightVisionAcc"
}
Event.OnServerEvent:Connect(function(Player, Selection, Price, Name)
print("Event fired")
local Gui = Player.PlayerGui:WaitForChild("MainGui")
if Selection == Name or Accessorys then
if Player.Character:FindFirstChild(Name) or Player.Backpack:FindFirstChild(Name) then
print("You have this tool already")
else
local Tool = game.ServerStorage:FindFirstChild(Name):Clone()
Tool.Parent = Player.Backpack
end
end
end)
``` shop code