how to return stuff in roblox studio
Quick Answer
In Roblox Studio, “returning stuff” usually means one of two things:
- Returning values (like tables, strings, numbers) from a function or ModuleScript — this is scripting.
- Refunding/returning purchased items (avatar items, game passes) for Robux — this is done via Roblox support, not in Studio.
I’ll cover both, with extra focus on the scripting side since you mentioned Roblox Studio.
1. Returning Values in Roblox Studio (Scripting)
Functions in normal scripts
In a regular script (not a ModuleScript), you can return values from a function like this:
lua
local function getStats()
local health = 100
local speed = 16
return health, speed
end
local h, s = getStats()
print(h, s) -- 100 16
You can return:
- A single value:
return 5 - Multiple values:
return a, b, c - A table:
return {name = "Bob", age = 12}
Returning tables cleanly
If you return a table and want to use it elsewhere:
lua
local function makePlayerData()
return {
Name = "Player1",
Level = 5,
Inventory = {"Sword", "Potion"}
}
end
local data = makePlayerData()
print(data.Name) -- Player1
print(data.Inventory[1])-- Sword
If you ever see table: 0x... in the output, that just means you printed the
table itself instead of its contents. Use data.Name, loop through it, or
encode it with HttpService:JSONEncode(table) for display.
ModuleScripts and return
ModuleScripts are special: they must return exactly one value , which is
what other scripts get when they call require(). Common pattern:
lua
-- ModuleScript
local module = {}
function module.greet(name)
return "Hello, " .. name
end
function module.add(a, b)
return a + b
end
return module -- ⬅️ this is required
Then in another script:
lua
local Mod = require(path.To.ModuleScript)
print(Mod.greet("Alice")) -- Hello, Alice
print(Mod.add(2, 3)) -- 5
Common mistakes:
- Forgetting to return anything → error: “Module code did not return exactly one value”
- Returning multiple values instead of one table → same error
- Returning inside an
ifand not in all branches → sometimes returnsnil
Good structure:
lua
local module = {}
-- define functions / data
return module -- always at the very end
You can also return a single function or a single table of functions/data; the key is one value.
2. “Returning” Purchased Items (Refunds) – Not Done in Studio
If by “return stuff” you mean getting Robux back for items you bought (hats, accessories, game passes, etc.), that’s handled through Roblox’s support site, not inside Roblox Studio.
Basic refund process (as of 2024–2026)
- Go to:
https://www.roblox.com/support - Log in.
- Fill in:
- Your username
- A valid email (for Roblox to reply)
- Device you used (PC, iOS, Android, console, etc.)
- Under Help Category :
- Choose: “Purchases using Robux”
- Under Help Subcategory :
- “Website item” for avatar shop items (hats, shirts, etc.)
- “In-experience item” for game passes or in-game purchases
- In the description, clearly state:
- That you want a refund
- The exact item name
- The price in Robux
- Briefly why (e.g., accidental purchase, didn’t mean to buy, etc.)
- Submit the form and complete the captcha.
- Wait for a response (often within a day or so).
Important notes from community guides and tutorials:
- Refunds are not guaranteed ; Roblox reviews each case.
- It helps to:
- Request soon after purchase
- Provide accurate item name/ID and price
- Be honest and clear in the description
This process is external to Roblox Studio; you do it in a browser or the Roblox app.
3. Mini Checklist
If you’re scripting in Roblox Studio
-
Want to return data from a function?
→ Usereturn value(or multiple values, or a table). -
Making a ModuleScript?
→ Build a table (e.g.local module = {}), add functions/data, then end withreturn module.
If you’re trying to “return” bought items for Robux
- Don’t look in Roblox Studio.
- Use the Roblox Support / Contact Us form.
- Choose “Purchases using Robux” → correct subcategory → explain and submit.
If you tell me which one you meant (script returns vs item refunds) and show a bit of your code or situation, I can give a tailored snippet or step‑by‑step for your exact case.
Information gathered from public forums or data available on the internet and portrayed here.