You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
Add cash to the player by 15
What is the issue? Include screenshots / videos if possible!
The sum is wrong. For example:
The player’s cash is 15.
The script adds 15, the sum should be 30 but it’s 45?
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have looked for solutions on the devforum, but they were dealing with decimals.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- Script #1
local Printer = {}
Printer.__index = Printer
function Printer.new(model)
--Variables (Initialization and Declaration)
local SoundService = game:GetService("SoundService")
local NewPrinter = setmetatable({}, Printer)
local PrintedEvent = Instance.new("BindableEvent")
NewPrinter.Paper = 15
NewPrinter.Security = 10
NewPrinter.PrintAmount = 15
NewPrinter.Printed = PrintedEvent.Event
local Prompt = Instance.new("ProximityPrompt", model)
Prompt.ObjectText = "Printer"
Prompt.ActionText = "Print Money"
--Behavior
Prompt.Triggered:Connect(function(player)
NewPrinter.Printed:Connect(function()
local cash = player:WaitForChild("leaderstats"):WaitForChild("Cash")
if cash:IsA("IntValue") then
cash.Value += NewPrinter.PrintAmount
NewPrinter.Paper -= 1
NewPrinter.Security -= 1
end
end)
PrintedEvent:Fire(player)
end)
return NewPrinter
end
return Printer
--Script #2
local PrinterClass = require(game:GetService("ReplicatedStorage"):WaitForChild("Modules"):WaitForChild("Classes"):WaitForChild("Printer"))
local Printer = PrinterClass.new(script.Parent)
Printer.Printed:Connect(function()
print("Printed cash!")
print("Printer Security: " .. Printer.Security)
print("Printer Paper: " .. Printer.Paper)
print("Printer Amount: " .. Printer.PrintAmount)
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.