allangood
|
  |
| Joined: 10 Oct 2009 |
| Total Posts: 76 |
|
|
| 26 Jun 2017 10:40 PM |
I was working on a self-made character animation script to replace the "Animate" script that is used by ROBLOX to make it more easier to edit the player animations (for me at least). The script worked initially but then some time later the character suddenly disappeared, with the velocity and even position being (nan,nan,nan). I would like to know what the problem is and how to fix it. Thank you.
Here are the scripts, if you need them:
1. "Animate"
local humanoid = script.Parent:WaitForChild("Humanoid") local animationModule = require(script.AnimationModule) local standardAnimations = script.StandardAnimations
function WhenIdle() animationModule.TurnOffAllAnimations(true) end humanoid.PlatformStanding:connect(WhenIdle)
function WhenRunning(speed) if speed > 0.55 then animationModule.TurnOffAllAnimations(false) standardAnimations.Running.Value = true else animationModule.TurnOffAllAnimations(true) end end humanoid.Running:connect(WhenRunning)
function WhenFalling() local root = script.Parent:FindFirstChild("HumanoidRootPart") local speed = (root.Velocity).magnitude if speed > 0.55 then animationModule.TurnOffAllAnimations(false) standardAnimations.Falling.Value = true else animationModule.TurnOffAllAnimations(true) end end humanoid.FreeFalling:connect(WhenFalling) humanoid.FallingDown:connect(WhenFalling)
function WhenJumping() animationModule.TurnOffAllAnimations(false) standardAnimations.Jumping.Value = true end humanoid.Jumping:connect(WhenJumping)
2. "AnimationScript"
local animationBool = script.Parent local humanoid = animationBool.Parent.Parent.Parent:WaitForChild("Humanoid") while true do wait(0.005) if animationBool.Value == true then local currentAnimations = humanoid:GetPlayingAnimationTracks() local k = 0 for i = 1, #currentAnimations do if currentAnimations[i].Animation == animationBool.Animation then k = k+1 end end if k == 0 then local animation = humanoid:LoadAnimation(animationBool.Animation) animation:Play() end elseif animationBool.Value == false then local currentAnimations = humanoid:GetPlayingAnimationTracks() for i = 1, #currentAnimations do if currentAnimations[i].Animation == animationBool.Animation then currentAnimations[i]:Stop() currentAnimations[i]:Destroy() end end end end
3. "AnimationModule"
local standardAnimations = script.Parent.StandardAnimations local toolAnimations = script.Parent.ToolAnimations local animationModule = {}
function animationModule.TurnOffAllAnimations(returnToIdle) local standardAnimationBools = standardAnimations:GetChildren() local toolAnimationBools = toolAnimations:GetChildren() for i = 1, #standardAnimationBools do standardAnimationBools[i].Value = false end for j = 1, #toolAnimationBools do toolAnimationBools[j].Value = false end if returnToIdle == true then standardAnimations.Idle.Value = true end end return animationModule
|
|
|
| Report Abuse |
|
|
LowOnXTC
|
  |
| Joined: 02 Jul 2012 |
| Total Posts: 563 |
|
|
| 26 Jun 2017 10:46 PM |
Lol don't use that..
Let's drift out to sea. ~LowOnXTC |
|
|
| Report Abuse |
|
|
allangood
|
  |
| Joined: 10 Oct 2009 |
| Total Posts: 76 |
|
|
| 26 Jun 2017 11:34 PM |
@LowOnXTC "Lol don't use that..."
I could say that for pretty much any script that doesn't work as intended, so please explain yourself. Thank you.
Meanwhile, I am waiting for answers from other people. |
|
|
| Report Abuse |
|
|
allangood
|
  |
| Joined: 10 Oct 2009 |
| Total Posts: 76 |
|
|
| 27 Jun 2017 12:26 AM |
| I still need someone to help. Thank you. |
|
|
| Report Abuse |
|
|
allangood
|
  |
| Joined: 10 Oct 2009 |
| Total Posts: 76 |
|
| |
|