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

How do I make CFrame changes overwrite animations and tools?

Asked by 7 years ago

I am decently new to CFrames and completely new at CFrame animation. I couldn't find any tutorials on how to do CFrame animations so I used the animation plugin to make an animation then just printed the .C1 of all the character joints for each frame and put them in a table. Then I just had a for loop set my characters joints to those when you click with a tool equipped. The animation works, but the problem is any animations that play while it is playing the CFrame animation play over it. So if the player jumps their arms flail and their feet pull pack. And because the player has a tool equipped their arm is extended and its CFrame doesn't change.

Here is the script (minus the cframes because question was over 10,000 characters and would not post)

01local player = game.Players.LocalPlayer
02local db = true--debug variable
03local dw = 1
04if db then--if in debug mode make things pause for 5 times as long
05    dw = 5
06end
07local root = {}--table of cframes for RootJoint
08local lhip = {}--table of cframes for Left Hip
09local rhip = {}--table of cframes for Right Hip
10local lshoulder = {}--table of cframes for Left Shoulder
11local rshoulder = {}--table of cframes for Right Shoulder
12function DJ()
13    local tool = Instance.new("Tool", player:WaitForChild("Backpack"))
14    tool.Name = "DJ Booth"
15    tool.GripPos = Vector3.new(0,1,0)
View all 77 lines...

So how would I temporarily disable the player's animations and make the player's hand not extend with the tool equipped? I know I could use a HopperBin but those are depreciated.

2 answers

Log in to vote
0
Answered by 7 years ago

Remove 'Animator' inside the Humanoid of a character. It's basically the animation core. Then, do:

1animator = Instance.new('Animator',humanoid)

to add it back. Hope I've helped!

0
Yes it helped, but it only solved half of the problem. justoboy13 153 — 7y
0
Check my post below to see the rest of the problem. justoboy13 153 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

OK so, my script now disables the animate script while my animation plays so it doesn't get overwritten. However, there is still the problem of how the tool makes the player's arm extend. I have it set to unequip all the player's tools with :UnequipTools() (hoping the player's arm would return to its normal position) and then I do tool:Destroy(). But then player's arm gets permanently stuck pointing forward. For some reason if you :Destroy() the tool while the click function is running (even from another script) the players' arm's default position is set to pointing straight forward.

0
Add it back? or does that not work brokenVectors 525 — 7y
0
No that does not work. For some reason is you delete or unequip the tool when that function is running the players arm is stuck in that position even if another tool is equiped. I am working on a solution i think might work justoboy13 153 — 7y
0
I just removed the handle from the tool and welded it to the player's arm so their arm doesn't extend. justoboy13 153 — 7y

Answer this question