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

How to do multi animations?

So like for eg: I want to break some one's neck, so when i'm near him i can do that, but if i'm not a person. i want to collect stuff, and i use my animation for collecting stuff, but how do you do two different animations by press two same keys?

3 comments

0

Please try to attempt this yourself. Write some code, basically. If you really can't get it to work, take the code you've written and bring it here.

0

do i have to do if and else statments?

0

If/else are used to check is something, like a property or variable is true; assuming you're only familiar with them, it's one of many important elements when scripting games.

1 answer

There are a few ways you can do this.

First you can use the ROBLOX Animation method. It is a bit unclean but it works.

Second you can use CFrame, this is probably most efficient.(Vector3 does not allow bricks to pass through each other)

Third you can use Motor6d, it is pretty buggy because of the new ROBLOX animations but it still works.

In regards to the key pressing this is how you do it.

--local script in StarterGui or StarterPack

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse() -- I know its odd using a Mouse when key pressing but this is lua is....

function onKey(key)
key = key:lower() --makes it so you can press the key even when in caps lock
if key == "f" then
--Your animation code here
end
Mouse.KeyDown:connect(onKey)

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