generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Problem with Character Animations

Previous Thread :: Next Thread 
allangood is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. allangood
Joined: 10 Oct 2009
Total Posts: 76
27 Jun 2017 09:31 AM
Can someone help, please?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image