local RequiredGold = script.Parent.Parent.Parent.Price.Value
local player = game.Players.LocalPlayer
script.Parent.MouseClick:Connect(function(player)
if player.Data.Beli.Value >= RequiredGold then
player.Data.Beli.Value = player.Data.Beli.Value - RequiredGold
if not player.PlayerGui:FindFirstChild("Success") then
local Success = script.Success:clone()
Success.Parent = player.PlayerGui
wait(2)
player.Character.Humanoid:UnequipTools()
Success:Destroy()
end
if player.Backpack:FindFirstChild(player.MLStats.MLUse.Value) then
player.Backpack:FindFirstChild(player.MLStats.MLUse.Value):Destroy()
end
player.MLStats.MLUse.Value = script.MELEE.Value
local Melee = game.ServerStorage.Melee:FindFirstChild(player.MLStats.MLUse.Value):Clone()
Melee.Parent = player.Backpack
else
if not player.PlayerGui:FindFirstChild("Failed") then
local Failed = script.Failed:clone()
Failed.Parent = player.PlayerGui
wait(2)
Failed:Destroy()
end
end
wait(2)
end)
i want Add to this script when player buy this item before the shop dont take money from him just give him it