· 2 years ago · Oct 05, 2023, 08:15 AM
1local playerId = input("Enter the player's ID: ")
2local apiKey = input("Enter the API key: ")
3
4-- Get the player's current coin balance
5local response = http.get("https://api.roblox.com/users/" .. playerId .. "/coins", {
6 headers = {
7 ["Authorization"] = "Bearer " .. apiKey
8 }
9})
10local currentCoins = response:json()["coins"]
11
12-- Get the amount of coins to add
13local amount = tonumber(input("Enter the amount of coins to add: "))
14
15-- Add the coins to the player's account
16local response = http.post("https://api.roblox.com/users/" .. playerId .. "/coins", {
17 headers = {
18 ["Authorization"] = "Bearer " .. apiKey
19 },
20 body = {
21 ["coins"] = amount
22 }
23})
24
25-- Display a message to the user
26print("Added " .. amount .. " coins to the player's account.")
27