this is where is remote event
local repsto = game:GetService("ReplicatedStorage") local sellEvent = repsto:WaitForChild("Eventos").SellEvent
and this is my sell script
local sellitem = script.Parent.Parent.SellItem local itemprice = script.Parent.Parent.ItemPrice local sellbut = script.Parent local player = game.Players.LocalPlayer local inventory = player:WaitForChild("Inventory") local leaders = player:WaitForChild("leaderstats") local money = leaders:WaitForChild("Money") local backpack = inventory:FindFirstChild("BackPack") sellbut.MouseButton1Click:Connect(function() if sellitem.Text == "Coal" and inventory.Coal.Value >= 1 then local nice = inventory.Coal.Value * 10 money.Value = money.Value + nice backpack.Value = backpack.Value - inventory.Coal.Value inventory.Coal.Value = inventory.Coal.Value - inventory.Coal.Value elseif sellitem.Text == "Gold Ore" and inventory.GoldOre.Value >= 1 then local nice = inventory.GoldOre.Value * 100 money.Value = money.Value + nice backpack.Value = backpack.Value - inventory.GoldOre.Value inventory.GoldOre.Value = inventory.GoldOre.Value - inventory.GoldOre.Value elseif sellitem.Text == "Iron Ore" and inventory.IronOre.Value >= 1 then local nice = inventory.IronOre.Value * 50 money.Value = money.Value + nice backpack.Value = backpack.Value - inventory.IronOre.Value inventory.IronOre.Value = inventory.IronOre.Value - inventory.IronOre.Value else print("fail") end end)
i dont know how to use remote events :D
Make sure it's a serverscript. You can't give a player cash on the client side.
here is the code for the a normal script
local sellitem = script.Parent.Parent.SellItem local itemprice = script.Parent.Parent.ItemPrice local sellbut = script.Parent sellbut.MouseButton1Click:Connect(function(plr) local inventory = plr:WaitForChild("Inventory") local leaders = plr:WaitForChild("leaderstats") local money = leaders:WaitForChild("Money") local backpack = inventory:FindFirstChild("BackPack") if sellitem.Text == "Coal" and inventory.Coal.Value >= 1 then local nice = inventory.Coal.Value * 10 money.Value = money.Value + nice backpack.Value = backpack.Value - inventory.Coal.Value inventory.Coal.Value = inventory.Coal.Value - inventory.Coal.Value elseif sellitem.Text == "Gold Ore" and inventory.GoldOre.Value >= 1 then local nice = inventory.GoldOre.Value * 100 money.Value = money.Value + nice backpack.Value = backpack.Value - inventory.GoldOre.Value inventory.GoldOre.Value = inventory.GoldOre.Value - inventory.GoldOre.Value elseif sellitem.Text == "Iron Ore" and inventory.IronOre.Value >= 1 then local nice = inventory.IronOre.Value * 50 money.Value = money.Value + nice backpack.Value = backpack.Value - inventory.IronOre.Value inventory.IronOre.Value = inventory.IronOre.Value - inventory.IronOre.Value else print("fail") end end)
If you need more help Dm me on discord cancle5#0035
Script.parent.mousebutton1click:connect(function(player) dont work it cant detect Who clicked it