How to Make a Sell Button in Roblox Studio!

Опубликовано: 03 Апрель 2026
на канале: OnFireRobloxScripting
5,555
92

Make an exit button and an open gui button with that:
   • Roblox How To | Frame with Open and Close ...  
Music used at the bottom of the description, scroll down a little for scripts.
Also make sure to leave your tutorials in the comments below!

My Discord server:   / discord  

Scripts: (Won't work unless you add to RemoteEvent shown in video)
leaderstats script:
--Made By: OnFireRobloxScripting - YT
--If You want Everything exactly like the video, don't change anything!
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"

local Clicks = Instance.new("IntValue",leaderstats) --Change all the Clicks to your stat like Gold or Strength
Clicks.Name = "Clicks"
Clicks.Value = 20 --Change the 0 to how many of your stat you want the player to start with

local Money = Instance.new("IntValue",leaderstats) --Change all the Money to your currency like Cash or Coins
Money.Name = "Money"
Money.Value = 400 --Change the 0 to how much currency you want the player to start with
end)

Local script:
--Made By: OnFireRobloxScripting - YT
--If You want Everything exactly like the video, don't change anything!
local Event = game.ReplicatedStorage:WaitForChild("Sell") --Replace "Sell" your RemoteEvent Name
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
Event:FireServer(player)
end)

Sell Stats Script:
--Made By: OnFireRobloxScripting - YT
--If You want Everything exactly like the video, don't change anything!
local Event = game.ReplicatedStorage:WaitForChild("Sell") --Replace "Sell" your RemoteEvent Name
local canhit = true

Event.OnServerEvent:Connect(function(player)
if canhit == true then
canhit = false
local leaderstats = player:WaitForChild("leaderstats")
local Money = leaderstats:WaitForChild("Money")--Replace ALL The Money with your currency name
local Clicks = leaderstats:WaitForChild("Clicks")--Replace ALL THE Clicks with your stat name

Money.Value += Clicks.Value --Don't forget to replace the Money here too!
Clicks.Value = 0 --Don't forget to replace the Clicks here too
task.wait(5) --Replace 5 with your cooldown timer, or replace with 0 if you don't want a cooldown
canhit = true
end
end)

Give Stats Script:
local part = script.Parent

part.Touched:Connect(function(hit)
if hit and hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local leaderstats = player:WaitForChild("leaderstats")
local Clicks = leaderstats:WaitForChild("Clicks")--Replace ALL The Clicks with your stat name

Clicks.Value += 1 --Change the 1 to how many stats you want to give the player per hit.
end
end)
Make sure to like and subscribe if you enjoyed it or if this video helped :)

Music Used (In order):

TheFatRat - Epic (Jackpot EP Track 2)
   • TheFatRat - Epic (Jackpot EP Track 2)  
TheFatRat - Origin (DOTA 2 Music Pack)
   • TheFatRat - Origin (DOTA 2 Music Pack)  
Tobu - Candyland [NCS Release]
   • Video  
Elektronomia - Sky High [NCS Release]
   • Elektronomia - Sky High | Progressive Hous...  
Outro Song:
TheFatRat - Unity
   • TheFatRat - Unity  

Thank you TheFatRat for all the AMAZING Free music! You're truly an awesome person!


Tags: #onfirerobloxscripting #roblox #robloxstudio #tutorial #howto