Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

'(' when parsing function, got 'function'?

Asked by 3 years ago
Edited 3 years ago

i need some help with this error i am new to scripting

local spinnerAlighned = isSpinnerAlighned(yellowSpinner)
    if spinnerAlighned == true then
        --Meter full
        yellowMeter.Meter.Size = UDim2.new(0, 283, 0, 73)
    else
        --Meter mostly empty
        local randomWidth = random:NextInteger(15, 40)
        yellowMeter.Meter.Size = UDim2.new(0, randomWidth, 0, 73)
    end

end
RunService.Heartbeat:Connect(update)

function updateSpinner(spinner, delta)

    --The speed of the spinner in degrees/Spinner
    local spinnerSpeed = spinner.SpinSpeed.Value

    --Rotate the spinner
    if spinner.ShouldSpin.Value == true then
        spinner.Rotation += spinnerSpeed * delta
    end     
end 


function updateMeter

--this is the error line
function isSpinnerAlighned (spinner)

    --The rotation of the spinners between 0-360
    local realRotation = spinner.Rotation % 360

    if realRotation < 10 or realRotation > 350 then
        return true
    else
        return false        
    end

end

1 answer

Log in to vote
0
Answered by 3 years ago
function spinnerAlighned(yellowSpinner) -- you incorrectly declared a function here
    if spinnerAlighned == true then
        --Meter full
        yellowMeter.Meter.Size = UDim2.new(0, 283, 0, 73)
    else
        --Meter mostly empty
        local randomWidth = random:NextInteger(15, 40)
        yellowMeter.Meter.Size = UDim2.new(0, randomWidth, 0, 73)
    end

end
RunService.Heartbeat:Connect(update)

function updateSpinner(spinner, delta)

    --The speed of the spinner in degrees/Spinner
    local spinnerSpeed = spinner.SpinSpeed.Value

    --Rotate the spinner
    if spinner.ShouldSpin.Value == true then
        spinner.Rotation += spinnerSpeed * delta
    end     
end 


function updateMeter() -- you left a line there you never declared the function correctly

end

--this is the error line
function isSpinnerAlighned(spinner)

    --The rotation of the spinners between 0-360
    local realRotation = spinner.Rotation % 360

    if realRotation < 10 or realRotation > 350 then
        return true
    else
        return false        
    end

end

im not entirely sure what you are trying to do here because there are a ton of missing variables but i cleaned up the syntax for you

0
oh thx for the help its_nowon 0 — 3y
0
Make sure to my a question as the answer @its_nowon PoppyandNeivaarecute 134 — 3y
Ad

Answer this question