#How do I make a shop?

1 messages · Page 1 of 1 (latest)

frail river
#

Hi im a new roblox devolper and I just figured out leaderstats I wanna know how I can make a npc e to open up a window to purchase items with your leaderstats and than when you purchase something you will lose the leaderstats and the item will be with you perm for the rest of the game even when you rejoin

blissful wind
#
-- this is gonna be for the opening thing
promptEvent:Connect(function(plr)
    plr.PlayerGui.shopui.Enabled = not plr.PlayerGui.shopui.Enabled
end)
-- for when the shop button is clicked
buttonEvent:Connect(function()
    if game.Players.LocalPlayer.leaderstats.currency.Value >= cost then
        event:FireServer() -- the event will be a remote event, add 1for eachstuf
    end
end)
-- for when the event is fired
event.OnServerEvent:Connect(function(plr)
    item:Clone().Parent = plr.Backpack
    plr.leaderstas.currency.Value -= cost
end)
#

havent tested yet so it might break

#

first is server sided, second is client and third is server

#

didnt make the saving yet

frail river
#

@blissful wind so basically i dont even know how to script so where do I put all these things... like im very new sorry

blissful wind
#

oh

#

first one assumes u have a proximity prompt to open it

#

so place first one in a proximity prompt

#

replace promptEvent with script.Parent

#

assuming u have made the gui, repalce shopui with the screengui name

#

second its a local script so place it in your ui

#

replace buttonEvent with script.Parent if u put it inside your button

#

make a remote event in replicated storage and name it anything

#

then just replace event with game.ReplicatedStorage.your event

#

third in server script service

#

it will be server

coral burrowBOT
#

studio** You are now Level 2! **studio

blissful wind
#

replace event with your remote event

#

assuming your item is a tool and in replicated storage, replace item with game.ReplicatedStorage.your item

#

then finally, replace the currencys in second and third with your money thing name

#

and replace costs in second and third with the cost assuming its a number

frail river
#

ok bro ima try my best

blissful wind
#

ok i wish u luck

#

if it works tell me

#

else tell me the errors in the output

frail river
#

ok heres my game is u wanna try it

#

if

#

@blissful wind

blissful wind
#

does it include the system i coded for u

#

ima try it

frail river
#

i havent done it yet

blissful wind
#

ok

peak grove
blissful wind
#

ok