#my animations wont load

1 messages · Page 1 of 1 (latest)

timber lark
#
local uis = game:GetService("UserInputService")
local player = game.Players.LocalPlayer 
local RS = game:GetService("ReplicatedStorage")

local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local root = character:WaitForChild("HumanoidRootPart")
local dashAnim = RS:WaitForChild("DashAnimation")

local DashCD = false

local animator = humanoid:FindFirstChildOfClass("Animator")
if not animator then
    animator = Instance.new("Animator")
    animator.Parent = humanoid
end
local dashTrack = animator:LoadAnimation(dashAnim)


uis.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end 

    if input.KeyCode == Enum.KeyCode.Q and not DashCD then
        DashCD = true
        dashTrack:Play()

        local dash = Instance.new("BodyVelocity")
        dash.MaxForce = Vector3.new(1, 0, 1) * 30000
        dash.Velocity = root.CFrame.LookVector * 100
        dash.Parent = root
        

        game.Debris:AddItem(dash, 0.3)

        task.wait(1)
        DashCD = false
    end
end)

my animations wont load i dont know why everything else works

jolly brook
#

Is it an animation uploaded by you?

#

Also

#

You're checking if dashCD = true

#

But before this check it never sets to true

#

You must change that i guess, change to dashCD == false or remove the "not dashCD" and put dashCD only

icy river
#

this is also prob ai code so it's probably the anim id

#

or animation priority

jolly brook
jolly brook
#

Because dashcd is false

#

So "not dashCD" would be like dashCD = true

icy river
#

'not [condition]' just checks the opition of condition's truthy/falsey value

#

not true = false, not false = true

jolly brook
icy river
#

yes

#

so the condition for the if statement becomes true

jolly brook
#

It's suppose to be a debounce so i think that's the mistake of the code he showed

icy river
#

it is a debounce but thats not the issue, that works fine

jolly brook
icy river
#

if statements just run if the specified condition is true

#

if dash = false

#

and you say 'if not dash'

#

thats the same as saying 'if true'

jolly brook
icy river
#

it doesnt need to, that if statement only fires if DashCD is false

#

'not true' = false

#

'not false' = true

jolly brook
#

But dashcd is not = true that's what i'm saying

icy river
#

it's set to true after the statement fires

jolly brook
#

?

icy river
#

ill write it in code

jolly brook
#

Ok

icy river
#
local x = false

if not x then
  print("hello")
end
#

this would print hello, because x = false, therefore 'not x' = true

jolly brook
#

Btw what i'm saying is just what i think because when i make debounces i don't really use "not"

icy river
#

that's just standard debounce practice, but you can do it either way

#

it would be weird if 'Cooldown = true' means you're not on cooldown

#

that's the point of using 'not' here

jolly brook
#

Thanks for explaining, i really had no idea

limpid vale
#

not, and, or, stuff like that used to bewilder me every time

icy river