You can write your topic however you want, but you need to answer these questions:
-
I want to be able to add cash when clicking the button
-
When I click on the buttton it says ServerScriptService.TS.Services.ClickService:114: attempt to perform arithmetic (add) on number and function.
On line 114
-- Compiled with roblox-ts v1.0.0
local TS = require(game:GetService("ReplicatedStorage"):WaitForChild("rbxts_include"):WaitForChild("RuntimeLib"))
local _0 = TS.import(script, TS.getModule(script, "knit").src)
local Knit = _0.KnitServer
local RemoteSignal = _0.RemoteSignal
local Players = TS.import(script, TS.getModule(script, "services")).Players
local PetService = TS.import(script, game:GetService("ServerScriptService"), "TS", "Services", "PetService")
local ProfileService = TS.import(script, game:GetService("ServerScriptService"), "TS", "Services", "ProfileService")
local DebounceTable = {}
local RebirthTable = {}
local DebounceTime = 0.2
local RebirthAmount = 15
local ClickService = Knit.CreateService({
Name = "ClickService",
Client = {
GiveMePoints = RemoteSignal.new(),
GiveRebirth = RemoteSignal.new(),
GetRebirthTable = function(self)
return RebirthTable
end,
},
KnitInit = function(self) end,
KnitStart = function(self)
do
local _1 = 1
while _1 < RebirthAmount do
local i = _1
local _2 = RebirthTable
local _3 = {
Cost = 5 ^ (i - 1) * 25,
Rebirths = 5 ^ (i - 1),
Gems = 5 ^ (i - 1) * 100,
}
-- ▼ Array.push ▼
_2[#_2 + 1] = _3
-- ▲ Array.push ▲
_1 = i
_1 += 1
end
end
Players.PlayerAdded:Connect(function(plr)
if plr then
local _1 = DebounceTable
local _2 = plr.UserId
local _3 = {
ClickDebounce = os.clock(),
}
-- ▼ Map.set ▼
_1[_2] = _3
-- ▲ Map.set ▲
end
end)
Players.PlayerRemoving:Connect(function(plr)
local _1 = DebounceTable
local _2 = plr.UserId
-- ▼ Map.delete ▼
_1[_2] = nil
-- ▲ Map.delete ▲
end)
self.Client.GiveRebirth:Connect(function(plr, selected)
if plr then
local rebirth = RebirthTable[selected - 1 + 1]
if rebirth then
local Data = ProfileService:GetData(plr)
if Data then
if Data.Cash >= rebirth.Cost + (Data.Rebirths * rebirth.Cost) then
local multiplierarray = {0,0}
local CandyMultiplier = TS.import(script, game:GetService("ReplicatedStorage"), "TS", "PetSystemModules", "Util", "MultiplierCalculator").CalculatePetMultiplier2
Data.Cash = 0
local clickmultiplier = 1
local _1 = Data.ids
-- ▼ ReadonlyArray.includes ▼
local _2 = false
for _3 = 1, #_1 do
if _1[_3] == 16807620 then
_2 = true
break
end
end
-- ▲ ReadonlyArray.includes ▲
if _2 then
clickmultiplier = 2
end
Data.Rebirths += rebirth.Rebirths
Data.Gems += (rebirth.Gems + CandyMultiplier + (CandyMultiplier + rebirth.Gems * multiplierarray[2] * 0.01)) * clickmultiplier
end
end
end
end
end)
self.Client.GiveMePoints:Connect(function(plr)
if plr then
local data = Knit.Services.ProfileService:GetData(plr)
local _1 = DebounceTable
local _2 = plr.UserId
local plrTable = _1[_2]
if data and plrTable and os.clock() - plrTable.ClickDebounce >= DebounceTime then
local petmultiplier = TS.import(script, game:GetService("ReplicatedStorage"), "TS", "PetSystemModules", "Util", "MultiplierCalculator").CalculatePetMultiplier
local multiplierarray = {0, 0}
local clickmultiplier = 1
local _3 = data.ids
-- ▼ ReadonlyArray.includes ▼
local _4 = false
for _5 = 1, #_3 do
if _3[_5] == 16807613 then
_4 = true
break
end
end
-- ▲ ReadonlyArray.includes ▲
if _4 then
clickmultiplier = 2
end
data.Cash += (1 + petmultiplier + data.Rebirths + (petmultiplier + data.Rebirths * multiplierarray[1] * 0.01)) * clickmultiplier
plrTable.ClickDebounce = os.clock()
end
end
end)
end,
})
return ClickService