Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

2 comments

0

oh thx for the help

0

Make sure to my a question as the answer @its_nowon

This discussion is preserved as it was. New answers, comments, and votes are closed.