Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --leaderstats--
- game.Players.PlayerAdded:Connect(function(player)
- local leaderstats = Instance.new("Folder")
- leaderstats.Name = "leaderstats"
- leaderstats.Parent = player
- local Cash = Instance.new("IntValue")
- Cash.Name = "Cash"
- Cash.Value = 100
- Cash.Parent = player.leaderstats
- end)
- --close/open shop--
- db = false
- script.Parent.MouseButton1Click:Connect(function(clicked)
- if db == false then
- db = true
- script.Parent.Text = "Exit"
- script.Parent.Parent.Frame.Visible = true
- elseif db == true then
- db = false
- script.Parent.Text = "Shop"
- script.Parent.Parent.Frame.Visible = false
- end
- end)
- --Buy script--
- script.Parent.MouseButton1Click:Connect(function(clicked)
- local player = script.Parent.Parent.Parent.Parent.Parent
- if player.leaderstats.Cash.Value == 100 or player.leaderstats.Cash.Value >= 100 then
- local parent = player.Backpack
- local sword = game.ReplicatedStorage.Tools.ClassicSword:Clone()
- player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 100
- sword.Parent = parent
- elseif player.leaderstats.Cash.Value ~= 100 then
- script.Parent.Text = "Not enough money!"
- wait(2)
- script.Parent.Text = "Sword - 100"
- end
- end)
- --The rest of the steps will be in the video!
Advertisement
Add Comment
Please, Sign In to add comment