Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to do multi animations?

Asked by 8 years ago

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?

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. adark 5487 — 8y
0
do i have to do if and else statments? mungshuan 30 — 8y
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. Houlardy642 28 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

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)

Ad

Answer this question