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: Object must be in Workspace before loading Animation?

Previous Thread :: Next Thread 
Laxusss is not online. Laxusss
Joined: 15 Jun 2013
Total Posts: 6042
28 Feb 2016 10:14 AM
Trying to make a charging animation, and it works in studio. And when you join in the game it works until you reset. Then it shows the error stated in the title.

Any reasons why?



Report Abuse
Laxusss is not online. Laxusss
Joined: 15 Jun 2013
Total Posts: 6042
28 Feb 2016 10:46 AM
;(



Report Abuse
Laxusss is not online. Laxusss
Joined: 15 Jun 2013
Total Posts: 6042
28 Feb 2016 11:16 AM
Not sure, but I think it has something to do with this:

local animation = Humanoid:WaitForChild("ChargeAnim")
local animationOn = Humanoid:LoadAnimation(animation)



Report Abuse
Laxusss is not online. Laxusss
Joined: 15 Jun 2013
Total Posts: 6042
28 Feb 2016 01:28 PM
1111
Report Abuse
Laxusss is not online. Laxusss
Joined: 15 Jun 2013
Total Posts: 6042
28 Feb 2016 03:26 PM
this doesnt work either

if Humanoid and animation then
local animationOn = Humanoid:LoadAnimation(animation)

i tried to wait for them to load but still doesnt work, same error



Report Abuse
128Gigabytes is online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
28 Feb 2016 03:27 PM
Just wait until its in the workspace.
Report Abuse
Laxusss is not online. Laxusss
Joined: 15 Jun 2013
Total Posts: 6042
28 Feb 2016 03:29 PM
How much I go about doing that?

I tried this but it doesnt error anymore but it still doesn't work.

if animation.Parent.Parent.Parent ~= game.Workspace then
repeat wait() until animation.Parent.Parent.Parent == game.Workspace



Report Abuse
Laxusss is not online. Laxusss
Joined: 15 Jun 2013
Total Posts: 6042
28 Feb 2016 03:30 PM
Sorry I meant 'How would I go about doing that?'



Report Abuse
Laxusss is not online. Laxusss
Joined: 15 Jun 2013
Total Posts: 6042
28 Feb 2016 03:36 PM
Well I just figured out that if I add a wait(2) to the script it works, but I don't understand why it doesnt work without. I 'WaitForChild()' almost everything





Report Abuse
Laxusss is not online. Laxusss
Joined: 15 Jun 2013
Total Posts: 6042
28 Feb 2016 03:44 PM
Fixed it! :DD


local animation = Humanoid:WaitForChild("ChargeAnim")
repeat wait() until Character:FindFirstChild('Humanoid') and Character.Humanoid:FindFirstChild('ChargeAnim')
local animationOn = Humanoid:LoadAnimation(animation)



Report Abuse
Laxusss is not online. Laxusss
Joined: 15 Jun 2013
Total Posts: 6042
28 Feb 2016 04:09 PM
nvm it didnt work but the wait(2) did :/



Report Abuse
Laxusss is not online. Laxusss
Joined: 15 Jun 2013
Total Posts: 6042
28 Feb 2016 04:19 PM
I've used prints to find out where it stops and the problem is differently this



local animationOn = Humanoid:LoadAnimation(animation)
I don't know why though because I wait for everything to load


Things I load:


-- Loading assets --

-- Loading Character --
local player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:wait()
print('Character lol')
-- Done loading, back to loading asssets --

local UIS = game:GetService("UserInputService")
print('Input')
local Humanoid = Character:WaitForChild("Humanoid")
print('human')
local Charge = Character['Left Leg']:WaitForChild("Charge")
print('charge1')
local Charge2 = Character['Right Leg']:WaitForChild("Charge2")
print('charge2')
local Remote1 = Character.Torso:WaitForChild("RemoteOn")
print('remote1')
local Remote2 = Character.Torso:WaitForChild("RemoteOff")
print('remote2')
local animation = Humanoid:WaitForChild("ChargeAnim")
print('charge animation')
repeat wait() until Character:FindFirstChild('Humanoid') and Character.Humanoid:FindFirstChild('ChargeAnim')
print('waited')
local animationOn = Humanoid:LoadAnimation(animation)
print('loaded animation')



Report Abuse
Laxusss is not online. Laxusss
Joined: 15 Jun 2013
Total Posts: 6042
28 Feb 2016 04:22 PM
Output:

Characterlol
Input
human
charge1
charge2
remote1
remote2
charge animation
waited
-- Object must be in Workspace before loading animation.
loaded animation




Report Abuse
Laxusss is not online. Laxusss
Joined: 15 Jun 2013
Total Posts: 6042
28 Feb 2016 06:02 PM
heelp
Report Abuse
laughablehaha is not online. laughablehaha
Joined: 19 Apr 2012
Total Posts: 2495
28 Feb 2016 06:09 PM
So you are saying you are fetching an already existing animation and loading it to you plr humanoid.
Report Abuse
Laxusss is not online. Laxusss
Joined: 15 Jun 2013
Total Posts: 6042
28 Feb 2016 06:12 PM
yes
Report Abuse
laughablehaha is not online. laughablehaha
Joined: 19 Apr 2012
Total Posts: 2495
28 Feb 2016 06:13 PM
I would just make the animation in the script so you don't have the hassle of looking for it.
Report Abuse
Laxusss is not online. Laxusss
Joined: 15 Jun 2013
Total Posts: 6042
28 Feb 2016 06:25 PM
Not a bad idea o:
Report Abuse
BlueWizard12345 is not online. BlueWizard12345
Joined: 31 Mar 2012
Total Posts: 906
28 Feb 2016 06:53 PM
You should use loadanimation the line before it plays. (If you're using an event, put the loadanimation line in the event)
Report Abuse
Dark_Legacy is not online. Dark_Legacy
Joined: 15 Jun 2013
Total Posts: 6333
28 Feb 2016 07:48 PM
Hmm



Report Abuse
Dark_Legacy is not online. Dark_Legacy
Joined: 15 Jun 2013
Total Posts: 6333
29 Feb 2016 05:21 PM
Fixed!
Apparently :LoadAnimation() doesn't wait for :WaitForChild() I'm guessing so I used a repeat wait in the beginning of the script so it doesn't even activate until it's been loaded.


Animation.Parent = c:WaitForChild("Humanoid")
repeat wait() until Animation.Parent == c:WaitForChild("Humanoid")
Skill.Parent = p.Backpack
Skill.Disabled = false



Report Abuse
TheEndermanofKewl is not online. TheEndermanofKewl
Joined: 18 Aug 2012
Total Posts: 24
12 Jun 2016 04:11 PM
You need to wait the number of seconds the animation is in length EXACTLY in order to play another animation afterwards. <:^D
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