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

How would you animate a tool?

Asked by
shakran 23
7 years ago
Edited 7 years ago

Like I want to know if its possible to make a tool animate using animation editor. I was thinking of making a basketball dribble using animations but im not sure how exactly. Iv looked into animations itself and I tried to make one myself but it came out wrong. I know I need to make a motor6d to attach the basketball to a block rig and made animations like you would usually do. But when I exported it out and added it to the tool, when the player touched the tool instead of dribbling like it should have, it dribbled sideways looking really wierd. I just want to know how you would create a basketball dribbling through animations.

0
yes abnotaddable 920 — 7y
0
Yeah, it very much is. AdvancedCode 136 — 7y
0
Can one of you tell me how exactly I can? Like if using motor6d to combine the tool with he player right when the player touches the ball is right. I spent a while but it keeps coming out wrong. Not sure what to do :/ shakran 23 — 7y
0
alright I right up an answer but idk if it'll be exactly what you are looking for but it will help you abnotaddable 920 — 7y
View all comments (2 more)
0
Honestly at this point any advice would help :/ shakran 23 — 7y
0
accept my answer if it worked :D it took me a long time to write up abnotaddable 920 — 6y

1 answer

Log in to vote
3
Answered by 7 years ago

You can animate a tool.
You will need:
Some Scripting knowledge
A tool you would like to animate

To start off:
You need to take all of the baseparts (interact-able objects, e,g part, wedge, sphere, not scripts, values ect) in a model. One of the parts need to be called "FakeHandle" , this will be where you hold it. If you already have a part called Handle rename it to FakeHandle. Copy the fakehandle into workspace, as it is needed later.
Select the primary part of the model as FakeHandle.

Now you need an Animation Controller, unfortunately you cannot insert it right into the model straight away so you have to create it via script.
Insert a normal script into workspace. put this script inside it:

local a = Instance.new("AnimationController")
a.Parent = game.Workspace

Play the game, open workspace and copy the animation controller.
Stop playing the game.
Delete the script.
Paste the Animation Controller into the model.
Call it AC. Then use the custom character creator plugin to make the rig (tool).
CUSTOM CHARACTER CREATOR.
If you don't know how to make a rig, I recommend you watch this video, Please keep in mind YOU DO NOT NEED A HUMANOID ROOT PART. Its not using a humanoid.
video
Then download the animation plugin.
here...
make some animations.... lol

Then the scripting...
Create a tool and put the model you made earlier in the tool. Call the model "MovingParts". Insert a part into the tool called"Handle", DO NOT insert it into the model. The handle needs to be in the same position as the "Fake Handle"., it doesn't have to be perfect, though.
Insert a Local Script into the tool.
use this script...:

--Gun is the part of the gun that contains: Handle, Values and Scripts
local Gun = script.Parent
--AnimGun is a model because its a Rig, So it can be animated
local AnimGun = Gun:WaitForChild("MovingParts")

--Fake Handle (used in animation)
local FHandle = AnimGun:WaitForChild("FakeHandle")
--Real Handle (Used to hold tool)
local RHandle = Gun:WaitForChild("Handle")
--Make a table of the elements in MovingParts
local guntable = AnimGun:GetChildren()

--Make a weld from Real to Fake handle, parent weld to Real Handle
local HandleWeld = Instance.new("Weld",RHandle)
HandleWeld.Part0 = RHandle
HandleWeld.C0 = RHandle.CFrame:inverse()
HandleWeld.Part1 = FHandle
HandleWeld.C1 = FHandle.CFrame:inverse()

--Animating Part

local AnimationController = AnimGun:WaitForChild("AC") --Equivilent to Humanoid, instead used for animating NPCs
local Animation = Instance.new("Animation")
Animation.AnimationId = "https://www.roblox.com/Asset?ID=000000001" --Put the animation ID here
local LoadAnimation = AnimationController:LoadAnimation(Animation) --Loads the Animation
print("Loaded the Animation")
function onKeyPress(actionName, userInputState, inputObject) --Function for playing animations
    if userInputState == Enum.UserInputState.Begin then
        LoadAnimation:Play() --Plays the animation
        print("Animation played")
    end
end

game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.R) --when r pressed does function

should work

0
God I love you for this. Everything is so detailed. I really appreciate it. Ill try this out and see if it works. shakran 23 — 7y
0
Um i had a question. what if you wanted to animate the ball with the player itself shakran 23 — 7y
0
Like I get this is how to animate the tool specifically but how would you animate the tool with the player together. For example once a player gets the tool into his backpack it loads an animation. How would you make that animations using animation editor? shakran 23 — 7y
0
I'm not sure myself abnotaddable 920 — 6y
View all comments (3 more)
0
please accept if I helped / it worked :D abnotaddable 920 — 6y
0
Mb I forgot and thanks a lot shakran 23 — 6y
0
how would you rig the tool? you didnt say it clearly, if I wanted to rig a mag inside a gun what would have the Motor6D? O_OIMGONE 9 — 3y
Ad

Answer this question