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: I think I've found an impossible error.

Previous Thread :: Next Thread 
popdosprlte is not online. popdosprlte
Joined: 18 Dec 2009
Total Posts: 4801
22 Nov 2013 07:32 PM
Here is my code:
local ID = "CFMLA" --string
local AnimObj = script.Parent.Parent:waitForChild("Animate") -- script inside character

local Vel = AnimObj:waitForChild("D"..string.sub(ID,4,5)) -- NumberVal
print(Vel.Value)
print(Vel.Value -1)
Vel.Value = 0


But then this outputs:
0
-1
20:27:24.565 - Workspace.Player1.Horse.DragonScript:153: attempt to call field 'Value' (a userdata value)
20:27:24.566 - Script 'Workspace.Player1.Horse.DragonScript', Line 153
20:27:24.567 - stack end


How does it does the value suddenly become a userdata value when it was just a number I could do da math with just before?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Nov 2013 07:34 PM
print tostrings it, so do you have like a ValueObject in Val
Report Abuse
popdosprlte is not online. popdosprlte
Joined: 18 Dec 2009
Total Posts: 4801
22 Nov 2013 07:35 PM
The fact is Val IS a NumberValue.

Perchance this is due to it being inside of a localscript inside of the character?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Nov 2013 07:36 PM
I wouldn't think so, try this:

print("Val: " .. Val.Value)
Report Abuse
popdosprlte is not online. popdosprlte
Joined: 18 Dec 2009
Total Posts: 4801
22 Nov 2013 07:45 PM
Now more insanity:

Output:
0
Val: 0
NumberValue
20:44:19.813 - Workspace.Player1.Horse.DragonScript:154: attempt to call field 'Value' (a userdata value)
20:44:19.813 - Script 'Workspace.Player1.Horse.DragonScript', Line 154
20:44:19.814 - stack end


Code:
local Vel = AnimObj:waitForChild("D"..string.sub(ID,4,5))
print(Vel.Value)
print("Val: "..Vel.Value)
print(Vel.ClassName)
Vel.Value = 0

Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Nov 2013 07:47 PM
Okay that's weird...
Report Abuse
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
22 Nov 2013 07:54 PM
I second what cnt said. It's possible that there's a child called "Value" hence the "userdata" etc.
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
22 Nov 2013 08:48 PM
@Android
It checks an object's values before it checks it's children. If you have something named "Name" in an object, and try to do Obj.Name.Propery it'll error cause it went to the property first.
Report Abuse
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
22 Nov 2013 08:54 PM
@18
I know that, but how else can you explain this insensible error?
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
22 Nov 2013 08:57 PM
Magic.
Report Abuse
MettaurSp is not online. MettaurSp
Joined: 20 Mar 2010
Total Posts: 3179
22 Nov 2013 09:17 PM
Is this the only place where you reference the object? Since it says "call", something is definitely treating it as a function in the script. Try using ctrl+f to find "Vel(".
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
22 Nov 2013 11:04 PM
Wait, how do you know it's the "Vel.Value = 0" part? If the value is already 0, and you set it to 0, how do you know that that part is the one erroring? Unless thats the ENTIRE thing, then its somewhere further in.
Report Abuse
littleAU999 is not online. littleAU999
Joined: 15 Jan 2011
Total Posts: 1375
23 Nov 2013 06:33 AM
print(type(Vel.Value));
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
23 Nov 2013 09:51 AM
Vel.Value is a Roblox object. Vel.Value.Value is probably what you want.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
23 Nov 2013 10:08 AM
Pre

print(Vel.Value)
print(Vel.Value -1)


But then this outputs:
0
-1
Report Abuse
NickPatella is not online. NickPatella
Joined: 03 Oct 2010
Total Posts: 220
23 Nov 2013 11:01 AM
Perhaps the error is coming from another script..? I don't see 153 lines...
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
23 Nov 2013 11:20 AM
Guiesses; Den problem is solves, though Pops did not post the solution here.

Many many offerings goez to Galaxi for solving the impossibru problemos o' no-commas. Solved, done.


So yeah, all this time, Pops did NOT show us the line erroring. - As
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