#Expected identifier when parsing expression, got 'local'

30 messages · Page 1 of 1 (latest)

devout mica
#

I get the error "Workspace.Migsguycov_4.LocalScript:6: Expected identifier when parsing expression, got 'local'", idk how to fix it
This is the code btw:

local UserInputService = game:GetService("UserInputService")
local Character = game:GetService("Players").LocalPlayer.Character or game:GetService("Players").LocalPlayer.CharacterAdded:Wait()
local debounce = false
local slideAnim = -- insert the path to your slide animation here

local function onKeyPress(input)
    if input.KeyCode == Enum.KeyCode.Backspace then
        local Velocity = Character.HumanoidRootPart:FindFirstChild("Velocity")
        if Velocity then
            Velocity.Velocity = Vector3.new(0, 0, 0)
        end
    elseif input.KeyCode == Enum.KeyCode.LeftControl then
        if not debounce then
            debounce = true
            local SldAnimationPlay = Character.Humanoid:LoadAnimation(slideAnim)
            SldAnimationPlay:Play()
            local Velocity = Instance.new("BodyVelocity")
            Velocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
            Velocity.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 100
            Velocity.Name = "Velocity"
            Velocity.Parent = Character.HumanoidRootPart
            wait(1)
            SldAnimationPlay:Stop()
            Velocity:Destroy()
            wait(1)
            debounce = false
        end
    end
end

UserInputService.InputBegan:Connect(onKeyPress)
candid atlas
#

on line 5

#

put the path to the animation instance

devout mica
candid atlas
#

thats all?

#

@devout mica

devout mica
#

i defined the slideanim

candid atlas
#

send current script

devout mica
candid atlas
#

how

#

what did u type

devout mica
#
local UserInputService = game:GetService("UserInputService")
local Character = game:GetService("Players").LocalPlayer.Character or game:GetService("Players").LocalPlayer.CharacterAdded:Wait()
local debounce = false
local slideAnim = "rbxassetid://14964117242"

local function onKeyPress(input)
    if input.KeyCode == Enum.KeyCode.Backspace then
        local Velocity = Character.HumanoidRootPart:FindFirstChild("Velocity")
        if Velocity then
            Velocity.Velocity = Vector3.new(0, 0, 0)
        end
    elseif input.KeyCode == Enum.KeyCode.LeftControl then
        if not debounce then
            debounce = true
            local SldAnimationPlay = Character.Humanoid:LoadAnimation(slideAnim)
            SldAnimationPlay:Play()
            local Velocity = Instance.new("BodyVelocity")
            Velocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
            Velocity.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 100
            Velocity.Name = "Velocity"
            Velocity.Parent = Character.HumanoidRootPart
            wait(1)
            SldAnimationPlay:Stop()
            Velocity:Destroy()
            wait(1)
            debounce = false
        end
    end
end

UserInputService.InputBegan:Connect(onKeyPress)
candid atlas
#

wrong

#

thats not the path

devout mica
candid atlas
#

still wrong

devout mica
#

what did i do wrong

#

idk im new to bodyvelocity scripting

candid atlas
#
local UserInputService = game:GetService("UserInputService")
local Character = game:GetService("Players").LocalPlayer.Character or game:GetService("Players").LocalPlayer.CharacterAdded:Wait()
local debounce = false
local slideAnim = Instance.new("Animation")
slideAnim.AnimationId = "rbxassetid://14964117242"

local function onKeyPress(input)
    if input.KeyCode == Enum.KeyCode.Backspace then
        local Velocity = Character.HumanoidRootPart:FindFirstChild("Velocity")
        if Velocity then
            Velocity.Velocity = Vector3.new(0, 0, 0)
        end
    elseif input.KeyCode == Enum.KeyCode.LeftControl then
        if not debounce then
            debounce = true
            local SldAnimationPlay = Character.Humanoid:LoadAnimation(slideAnim)
            SldAnimationPlay:Play()
            local Velocity = Instance.new("BodyVelocity")
            Velocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
            Velocity.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 100
            Velocity.Name = "Velocity"
            Velocity.Parent = Character.HumanoidRootPart
            wait(1)
            SldAnimationPlay:Stop()
            Velocity:Destroy()
            wait(1)
            debounce = false
        end
    end
end

UserInputService.InputBegan:Connect(onKeyPress)
#

@devout mica

#

this might do it

#

and i might have done a typo and it wont work

candid atlas
#

@devout mica

torn daggerBOT
#

studio** You are now Level 12! **studio

candid atlas
#

does it?

torn daggerBOT
#

studio** You are now Level 11! **studio