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
#How do I make a shop?
1 messages · Page 1 of 1 (latest)
-- 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
@blissful wind so basically i dont even know how to script so where do I put all these things... like im very new sorry
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
** You are now Level 2! **
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
ok bro ima try my best
ok heres my game is u wanna try it
if
@blissful wind
i havent done it yet
ok
cool for helping but u shouldnt spoonfeed!!
ok