Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a character shop gui?

So I am trying to make an character shop gui but can't figure out how to do this I tried doing XxxLloyd061302xxXs video but it didn't work I will show you the script he maade so could you fix any problems with the script.

Script:

script.Parent.MouseButton1Click:connect(function()
 local RS = game:GetService("ReplicatedStorage")
 local item =  RS:WaitForChild("Raven")
 local price = 2000 -- Change Your Price Here
 local player = game.Players.LocalPlayer
 local stats = player:WaitForChild("leaderstats")
 
 if stats.Cash.Value == price then -- Change the Money to your Currency Name
  stats.Money.Value = stats.Money.Value - price
  local cloned = item:Clone()
  local cloned2 = item:Clone()
  
cloned.Parent = game.StarterGui.Locker --where u want it
cloned2.Parent = game.StarterGui.Locker --where u want it

cloned.Position = Vector3.new(0.155, 0,0.243, 0) --position
cloned2.Position = Vector3.new(0.155, 0,0.243, 0) --position


 end
end)


If you would like to know it is in a normal script and that I changed it a bit.

2 comments

0

use a local script for Guis and use playergui

0

what happens when your cash value is higher than the price but u wanna buy it? change "==" to ">=" (greater than or equal to)

2 answers

✓ Accepted answer

It is in PlayerGui not StarterGui and use alocal script, other than that I see no problem.

P.S. use :Connect() not :connect() it will help for the near future.

Here is the Local Script, I have edited it:

--use a local script

 local RS = game:GetService("ReplicatedStorage")
 local item =  RS:WaitForChild("Raven")
 local price = 2000 -- Change Your Price Here
 local player = game.Players.LocalPlayer
 local stats = player:WaitForChild("leaderstats")

script.Parent.MouseButton1Click:Connect(function()
--moved all the stuff to above

 if stats.Cash.Value == price then 
  stats.Money.Value = stats.Money.Value - price
  local cloned = item:Clone()
  local cloned2 = item:Clone()

cloned.Parent = player.PlayerGui.Locker --where u want it
cloned2.Parent = player.PlayerGui.Locker --where u want it

cloned.Position = Vector3.new(0.155, 0,0.243, 0) --position
cloned2.Position = Vector3.new(0.155, 0,0.243, 0) --position


 end
end)

If this works remember to accept it, if it does not please comment and tell me.

9 comments

0

One question how do I put it in player gui

0

@HiHowAreYah5 When you open up roblox studio on the right of your screen you should see the explorer and under that there should be a folder named StarterGui just drag it in

0

what is cash.value? is cash a folder if so can u tell me were to put it?

0

it doesn't work btw

0

dude.... that was a year ago

0

How do i even start

0

This was 1 year ago dont comment on old posts

0

bro.. this is a year old also it 100% worked when i made it

This discussion is preserved as it was. New answers, comments, and votes are closed.