#Pls help me im new to coding

25 messages · Page 1 of 1 (latest)

tidal grove
#

you probably forgot to close something with "end"

cedar inlet
#

but what tho ive tried that

tidal grove
#

could you show the whole function?

cedar inlet
#

wht do u mean by that?

tidal grove
#

like copy and paste the whole code for the function you made or screenshot of it

cedar inlet
#

i copy it hold on

#

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local FormatNumber = require(ReplicatedStorage.Libs.FormatNumber.Simple)
local Remote = ReplicatedStorage.Remotes

local Gui = script.Parent
local Frame = Gui.Frame

local Power = Frame.Power.Amount
local ClicksPerSec = Frame.Power.CPS
local BuyClicks = Frame.Power.Buy
local Rebirths = Frame.Rebirths.Amount

local ClicksDuringSecond = 0
local PreviousClicksAmount = 0

local CLICKS_PER_SECOND_STRING_TEMPLATE = "(+AMOUNT/sec)"

local function UpdateClicksPerSecond(amount: number)
local amountOfClicks = amount - PreviousClicksAmount
PreviousClicksAmount = amount
if amountOfClicks <= 0 then return end

ClicksDuringSecond += amountOfClicks
ClicksPerSec.Text = CLICKS_PER_SECOND_STRING_TEMPLATE:gsub("AMOUNT", FormatNumber.FormatCompact(ClicksDuringSecond))
ClicksPerSec.Visible = true

task.delay(1, function()
    ClicksDuringSecond -= amountOfClicks
    ClicksPerSec.Text = CLICKS_PER_SECOND_STRING_TEMPLATE:gsub("AMOUNT", FormatNumber.FormatCompact(ClicksDuringSecond))
    ClicksPerSec.Visible = ClicksDuringSecond > 0
end)

local function UpdateCurrency(currency: "Power" | "Rebirths", amount: number)
if currency == "Power" then
UpdateClicksPerSecond(amount)
Power.Text = FormatNumber.FormatCompact(amount)
elseif currency == "Rebirths" then
Rebirths.Text = FormatNumber.FormatCompact(amount)
end
end

UpdateCurrency("Power", Remote.GetData:InvokeServer("Power"))

Remote.UpdateClicks.OnClientEvent:Connect(function(amount)
UpdateCurrency("Power", amount)

end)

#

thats the code

topaz jewel
#
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local FormatNumber = require(ReplicatedStorage.Libs.FormatNumber.Simple)
local Remote = ReplicatedStorage.Remotes

local Gui = script.Parent
local Frame = Gui.Frame

local Power = Frame.Power.Amount
local ClicksPerSec = Frame.Power.CPS
local BuyClicks = Frame.Power.Buy
local Rebirths = Frame.Rebirths.Amount

local ClicksDuringSecond = 0
local PreviousClicksAmount = 0

local CLICKS_PER_SECOND_STRING_TEMPLATE = "(+AMOUNT/sec)"

local function UpdateClicksPerSecond(amount: number) 
    local amountOfClicks = amount - PreviousClicksAmount
    PreviousClicksAmount = amount
    if amountOfClicks <= 0 then return end

    ClicksDuringSecond += amountOfClicks
    ClicksPerSec.Text = CLICKS_PER_SECOND_STRING_TEMPLATE:gsub("AMOUNT", FormatNumber.FormatCompact(ClicksDuringSecond))
    ClicksPerSec.Visible = true
    
    task.delay(1, function()
        ClicksDuringSecond -= amountOfClicks
        ClicksPerSec.Text = CLICKS_PER_SECOND_STRING_TEMPLATE:gsub("AMOUNT", FormatNumber.FormatCompact(ClicksDuringSecond))
        ClicksPerSec.Visible = ClicksDuringSecond > 0
    end)


    
local function UpdateCurrency(currency: "Power" | "Rebirths", amount: number)
        if currency == "Power" then
            UpdateClicksPerSecond(amount)
        Power.Text = FormatNumber.FormatCompact(amount)
    elseif currency == "Rebirths" then
            Rebirths.Text = FormatNumber.FormatCompact(amount)
    end
end

UpdateCurrency("Power", Remote.GetData:InvokeServer("Power"))

    Remote.UpdateClicks.OnClientEvent:Connect(function(amount)
    UpdateCurrency("Power", amount)
end)
#

Just formatting

#

So ppl see clearer

cedar inlet
#

k

tidal grove
#

yeah so

#

you forgot an end

cedar inlet
#

where?

signal starBOT
#

studio** You are now Level 1! **studio

tidal grove
#
local function UpdateClicksPerSecond(amount: number) 
    local amountOfClicks = amount - PreviousClicksAmount
    PreviousClicksAmount = amount
    if amountOfClicks <= 0 then return end

    ClicksDuringSecond += amountOfClicks
    ClicksPerSec.Text = CLICKS_PER_SECOND_STRING_TEMPLATE:gsub("AMOUNT", FormatNumber.FormatCompact(ClicksDuringSecond))
    ClicksPerSec.Visible = true

    task.delay(1, function()
        ClicksDuringSecond -= amountOfClicks
        ClicksPerSec.Text = CLICKS_PER_SECOND_STRING_TEMPLATE:gsub("AMOUNT", FormatNumber.FormatCompact(ClicksDuringSecond))
        ClicksPerSec.Visible = ClicksDuringSecond > 0
    end)



    local function UpdateCurrency(currency: "Power" | "Rebirths", amount: number)
        if currency == "Power" then
            UpdateClicksPerSecond(amount)
            Power.Text = FormatNumber.FormatCompact(amount)
        elseif currency == "Rebirths" then
            Rebirths.Text = FormatNumber.FormatCompact(amount)
        end
    end

    UpdateCurrency("Power", Remote.GetData:InvokeServer("Power"))

    Remote.UpdateClicks.OnClientEvent:Connect(function(amount)
        UpdateCurrency("Power", amount)
    end)
end
#

it shouldnt show any errors now

topaz jewel
#

U forgot to close the updateclicksersecond

cedar inlet
#

oh ok ill try it

topaz jewel
#

Is this supposed to be one whole function called updateclickspersecond

cedar inlet
#

no look at the picture befor

#

before

topaz jewel
#

Did it work tho

cedar inlet
#

yh there are no errors