#Expected identifier

60 messages · Page 1 of 1 (latest)

dense prism
#

For some reason I'm getting this error saying "Expected identifier when parsing expression, got 'local' in my code for making something as simple as a dash system. I've been looking at it for a solid 2 hours now not knowing what to do.

ivory lantern
#

replace whatever is in isonground with the isonground in the if statement maybe

dense prism
#

it didn't work bc the local line w the problem is still identifying isOnGround so I can't put it in the if statement I just tried it thanks for the suggestion tho I didn't think about that

ivory lantern
dense prism
tulip willowBOT
#

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

dense prism
#

its at the top

#

in that ss im hovering over the error and its more zoomed out so you can see pretty much the whole thing but the line covered by the error is in the ss I first sent if you need to see that too

ivory lantern
# dense prism

you did "if humanoid.floormaterial ~= air and humanoid.floormaterial ~= water then"?

dense prism
#

?

#

the only if in there is the one covered by the error in the second ss but that says if isOnGround then

#

if thats what you meant

ivory lantern
#

also wat i meant is to replace the if statement with "if humanoid.floormaterial ~= air and humanoid.floormaterial ~= water then"

dense prism
#

ohhh ok

#

and i dont know how to make a code block im still VERY new to this stuff

#

sorry

ivory lantern
dense prism
#

I tried replacing the if statement and the same error is still in the same spot im going to try to go through the code again and look for a missing parenthesis or something because I think it might be a syntax error

ivory lantern
#

code block is like this:
`Lua `

#

wait

#

no

#

nvm

dense prism
#

huh

ivory lantern
dense prism
#

I did copy and paste your suggested if statement and its still the same error

ivory lantern
dense prism
#

it says the message is too long

#

do you want the whole script or just a part

ivory lantern
dense prism
#

if humanoid.FloorMaterial ~= Enum.Material.Air and humanoid.FloorMaterial ~= Enum.Material.Water then

ivory lantern
dense prism
#

its not that line its the one above it

tulip willowBOT
#

studio** You are now Level 2! **studio

dense prism
#

its local isOnGround = humanoid.FloorMaterial ~= Enum.Material.Air and humanoid.FloorMaterial ~= Enum.Material.Water

ivory lantern
#

or comment it out

#

see if it works

dense prism
#

and the error is expected identifier when parsing expression, got 'local'

#

I can't because its defining the isOnGround variable

#

so everything else gets an error

ivory lantern
ivory lantern
dense prism
#

local isOnGround = humanoid.FloorMaterial ~= Enum.Material.Air and humanoid.FloorMaterial ~= Enum.Material.Water

        if humanoid.FloorMaterial ~= Enum.Material.Air and humanoid.FloorMaterial ~= Enum.Material.Water then


        if moveDirection == Vector3.new(0,0,0) then -- if player is not currently moving/walking
            dashDirection = HRP.Position + Vector3.new(lookVector.X, 0, lookVector.Z)
        else -- if player are currently moving/walking
            dashDirection = HRP.Position + Vector3.new(moveDirection.X, 0, moveDirection.Z)
        end

        -- using bodygyro to rotate player to the dash direction smoothly
        local bodyGyro = Instance.new("BodyGyro")
        bodyGyro.Parent = HRP
        bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
        bodyGyro.D = 0 -- D is the dampening
        bodyGyro.P = 500000 -- P is aggressiveness
        bodyGyro.CFrame = CFrame.lookAt(HRP.Position, dashDirection) -- Making player look at the dash direction

        local attachment = Instance.new("Attachment")
        attachment.Parent = HRP

        -- now using VectorForce to move player forward
        local vectorForce = Instance.new("VectorForce")
        vectorForce.Parent = HRP
        -- VectorForce need attachment to tell where is player looking at
        vectorForce.Attachment0 = attachment
        vectorForce.Force = Vector3.new(0,0,minusVelocity) -- now it will move player forward as the settings

        loadedAnimation:Play() -- play the dash animation
        humanoid.AutoRotate = false -- prevent player to rotate by themselves

        wait(duration)

        humanoid.AutoRotate = true

        vectorForce:Destroy()
        bodyGyro:Destroy()
        attachment:Destroy()

        wait(duration) --- give some time before stopping the dash animation
        loadedAnimation:Stop()

    end
#

the "local" in the very first line is the one w the error

ivory lantern
#

ok so, remove the line defining the isonground statement

#

or make it a boolean

#

if humanoid.FloorMaterial ~= Enum.Material.Air and humanoid.FloorMaterial ~= Enum.Material.Water then
isongrond = true

#

else
isonground = false

#

you can do something like that

dense prism
#

you wanna see something funny

#

same problem same spot

#

dog wtf is wrong crying

#

im just gonna look the whole script over again and try to see if its just a missing parenthesis or something

ivory lantern
dense prism
#

its line 33 the very first "local"

#

holy shit

#

I fixed it