|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 22 Nov 2013 08:54 PM |
@18 I know that, but how else can you explain this insensible error? |
|
|
| Report Abuse |
|
|
| |
|
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 |
|
|
|
| 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 |
|
|
| |
|
|
| 23 Nov 2013 09:51 AM |
| Vel.Value is a Roblox object. Vel.Value.Value is probably what you want. |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 23 Nov 2013 11:01 AM |
| Perhaps the error is coming from another script..? I don't see 153 lines... |
|
|
| Report Abuse |
|
|
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 |
|
|