#Idk how to explain this

1 messages · Page 1 of 1 (latest)

jagged heart
#

So i have a script that does remoteevent on keybind but i need the remote event to actually change player's animation the problem is it worked when i had one keybind but with mutliple and each changing the animation it doesnt work pls help.

#

Mouse.KeyDown:Connect(function(key)
if (key == 'q') then
change and play idle animation 1
elseif (key == 'e') then
change and play idle animation 2
end

#

this is how it should look like i just dont know how to change and play the animations

#

i actually tried to add animation and just play it but it doesnt work with multiple anims

#

Mouse.KeyDown:Connect(function(key)
local IdleAnimation = Instance.new("Animation")
IdleAnimation.AnimationId = "rbxassetid://180435571" -- this is the default idle anim
local AnimationPlay = animator:LoadAnimation(IdleAnimation)
if (key == 'q') then
IdleAnimation.AnimationId = "rbxassetid://86786797515857" -- my anim 1
local AnimationPlay = animator:LoadAnimation(IdleAnimation)
IdleAnimation:Play()
elseif (key == 'e') then
IdleAnimation.AnimationId = "rbxassetid://93109033026292" -- my anim 2
local AnimationPlay = animator:LoadAnimation(IdleAnimation)
IdleAnimation:Play()
end

end)

this is actaully what am i trying rn but i dont know it thats the wight way

#

READ EVERYTHING ABOVE!!!

jagged heart
#

pls help someone

abstract flare
#

does the first anim work

#

but then the second not

#

and the first one was still playing

#

even tho u pressed other key

#

@jagged heart

jagged heart
#

None of them work

abstract flare
#

yes

#

because

#

you gotta play the LoadAnim

#

not the animation itself

#

u do "Instance.new("Animation"):Play()"

#

@jagged heart

#

local AnimationPlay = animator:LoadAnimation(IdleAnimation)

#

AnimationPlay:Play()

#

like this

#

or animator:LoadAnimation(IdleAnimation):Play()

#

the same

#

but I think u still will have an issue

#

just test this then tell me if it still doesnt work

jagged heart
#

Ill try tmmrw cuz izs late but thanks ill let you know

jagged heart
#

i think it works

#

the problem is the animation loads and plays but its stuck in weird position between the previous animation and the current one.

jagged heart
#

ok i found another problem i have these 2 animations, if they have same animation priority, switching between them makes you stuck between the animation 1 and the animation 2 and the animations dont fully play. If i set different animation priority to each one of them, then one will just completely override the other and and second animation wont play at all @abstract flare hopefully i explained it enough.

#

i just need so if i play one animation it will fully play and if i play the other it will also fully play.

#

like actually switch between them.

jagged heart
#

??

abstract flare
#

u have to stop the first animation

#

when starting the second animation

#

@jagged heart

#

so u make ```local Animation1 = Animator:LoadAnimation(Animation1)
local Animation2 = Animator:LoadAnimation(Animation2)

if Key.KeyCode == Enum.KeyCode.L then
Animation2:Stop()
Animation1:Play()

else
Animation1:Stop()
Animation2:Play()
end```

jagged heart
#

oh makes sence

jagged heart
#

wait

#

Mouse.KeyDown:Connect(function(key)
local IdleAnimation1 = Instance.new("Animation")
IdleAnimation1.AnimationId = "rbxassetid://88804290373500"
local Animation1Play = animator:LoadAnimation(IdleAnimation1)

local IdleAnimation2 = Instance.new("Animation")
IdleAnimation2.AnimationId = "rbxassetid://93109033026292"
local Animation2Play = animator:LoadAnimation(IdleAnimation2)
if (key == 'q') then
    Animation1Play:Play()
    Animation2Play:Stop()
elseif (key == 'e') then
    Animation2Play:Play()
    Animation1Play:Stop()
end

end)

I did this but it still doesnt work

#

@abstract flare

abstract flare
#

Why do u use (key == q)

#

Do if key.Keycode == enum.Keycode.Q then

jagged heart
#

ok but like it still doesnt work

#

can you help with it? @abstract flare

jagged heart
#

?

jagged heart
jagged heart
abstract flare
#

show me a clip atp

#

including ur script that ure using

#

@jagged heart

jagged heart
#

?

#

oh

north bloomBOT
#

studio** You are now Level 7! **studio

abstract flare
#

oh

#

u use key as in the mouse click

#

u should use userinputservice

#

@jagged heart

jagged heart
#

yeah i kinda expectedtht

#

im just dumb

#

but still

abstract flare
#

the Mouse.ButtonDown:Connect(function() <-- here doesnt have a argument as key

#

u use userinput service for input keys

#

like Q

#

E

#

R

#

or u use contextactionservice

#

but thats a little advanced

abstract flare
jagged heart
#

so like id UserInputService.InputBegan:Connect(function() or what?

#

@abstract flare

abstract flare
#

yes

jagged heart
#

and the if?

abstract flare
#

UserInputService.InputBegan:Connect(function(Input, gameProcessedEvent) <-- Input is the key and gameProc is when ure like chatting

#

what u will always do u is

jagged heart
#

ok

abstract flare
#

UserInputService.InputBegan:Connect(function(Input, GameProcessedEvent)
if GameProcessedEvent then return end

if Input.KeyCode == Enum.KeyCode.Q then
...
end
end)

jagged heart
#

@abstract flare

abstract flare
#

whats the priorit

#

y

jagged heart
#

uhh

#

well if i set both to core it does this

#

but if i set it to idle i think it wont load the other one at all

#

lemme try smth

#

ok i set both to idle but it still doesnt work

#

@abstract flare

abstract flare
#

ure creating a new animation everytime u click a key

#

put the animations outside userinput

jagged heart
#

how?

#

@abstract flare

abstract flare
#

wym

jagged heart
#

UserInputService.InputBegan:Connect(function(Input, GameProcessedEvent)
if GameProcessedEvent then return end
local IdleAnimation1 = Instance.new("Animation")
IdleAnimation1.AnimationId = "rbxassetid://98227665013276"
local Animation1Play = animator:LoadAnimation(IdleAnimation1)
local IdleAnimation2 = Instance.new("Animation")
IdleAnimation2.AnimationId = "rbxassetid://132028349673064"
local Animation2Play = animator:LoadAnimation(IdleAnimation2)
if Input.KeyCode == Enum.KeyCode.Q then
Animation1Play:Play()
Animation2Play:Stop()
elseif Input.KeyCode == Enum.KeyCode.E then
Animation2Play:Play()
Animation1Play:Stop()
end

end)

#

this is what i use rn

abstract flare
#

u just put them outside userinput

jagged heart
#

what specifically?

abstract flare
#

like ```
Local anima

userinput```

#

because whenever u click a key u create a new animation

#

thats why its overwriting the other animation

#
    IdleAnimation1.AnimationId = "rbxassetid://98227665013276"
    local Animation1Play = animator:LoadAnimation(IdleAnimation1)
    local IdleAnimation2 = Instance.new("Animation")
    IdleAnimation2.AnimationId = "rbxassetid://132028349673064"
    local Animation2Play = animator:LoadAnimation(IdleAnimation2)

UserInputService.InputBegan:Connect(function(Input, GameProcessedEvent)
    if GameProcessedEvent then return end
   
    if Input.KeyCode == Enum.KeyCode.Q then
        Animation1Play:Play()
        Animation2Play:Stop()
    elseif Input.KeyCode == Enum.KeyCode.E then
        Animation2Play:Play()
        Animation1Play:Stop()
    end

end)```
#

like this

jagged heart
#

IT WORKES

#

yoo tysm ik i was annoying

#

but im tryna understand ts and i think i just got it

#

@abstract flare thanks again

abstract flare
#

nah its alright

#

u didnt annoy me

jagged heart
#

k

abstract flare
#

have fun

jagged heart
#

idk how to rly explain but ill try my best.
So what you just saw is a system does something when key is pressed and.. i want to make it so that when i used q i can use another key to do something else but if i use different key like e then it will not work. Example: Q then N: something happens, E then N nothing happens/something different happens. Do you think there is a way to do such a thing? It might be much more difficult but i would appriciate if you could help me with this, its the last thing i need.

#

its ok if you dont tho