Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

sell gui in local script and if i sell, players dont see it, how to make it in normal script?

Asked by 4 years ago
Edited 4 years ago

this is where is remote event

1local repsto = game:GetService("ReplicatedStorage")
2local sellEvent = repsto:WaitForChild("Eventos").SellEvent

and this is my sell script

01local sellitem = script.Parent.Parent.SellItem
02local itemprice = script.Parent.Parent.ItemPrice
03local sellbut = script.Parent
04local player = game.Players.LocalPlayer
05local inventory = player:WaitForChild("Inventory")
06local leaders = player:WaitForChild("leaderstats")
07local money = leaders:WaitForChild("Money")
08local backpack = inventory:FindFirstChild("BackPack")
09 
10sellbut.MouseButton1Click:Connect(function()
11    if sellitem.Text == "Coal" and inventory.Coal.Value >= 1 then
12        local nice = inventory.Coal.Value * 10
13        money.Value = money.Value + nice
14        backpack.Value = backpack.Value - inventory.Coal.Value
15        inventory.Coal.Value = inventory.Coal.Value - inventory.Coal.Value
View all 29 lines...

i dont know how to use remote events :D

0
This would be sort of difficult to explain in an answer I recommend that you follow a video or 2 and mess around with them a little bit. Creeper4203 0 — 4y

2 answers

Log in to vote
0
Answered by
cancle5 120
4 years ago

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

01local sellitem = script.Parent.Parent.SellItem
02local itemprice = script.Parent.Parent.ItemPrice
03local sellbut = script.Parent
04 
05sellbut.MouseButton1Click:Connect(function(plr)
06local inventory = plr:WaitForChild("Inventory")
07local leaders = plr:WaitForChild("leaderstats")
08local money = leaders:WaitForChild("Money")
09local backpack = inventory:FindFirstChild("BackPack")
10    if sellitem.Text == "Coal" and inventory.Coal.Value >= 1 then
11        local nice = inventory.Coal.Value * 10
12        money.Value = money.Value + nice
13        backpack.Value = backpack.Value - inventory.Coal.Value
14        inventory.Coal.Value = inventory.Coal.Value - inventory.Coal.Value
15    elseif sellitem.Text == "Gold Ore" and inventory.GoldOre.Value >= 1 then
View all 28 lines...

If you need more help Dm me on discord cancle5#0035

0
Don't use a remote event like that since it's very easy for a exploiter to get inf cash. cancle5 120 — 4y
0
Yes ik but how to make sellinng moneyislands1 51 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

Script.parent.mousebutton1click:connect(function(player) dont work it cant detect Who clicked it

Answer this question