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: Attempt to call a number value error

Previous Thread :: Next Thread 
EvanHolt is not online. EvanHolt
Joined: 06 Sep 2008
Total Posts: 1264
10 Mar 2017 09:56 PM
What does the error "Attempt to call a number value" mean? This is the code causing it: damage = { max = 30, min = ## # ######## = { max = 80, min = 120 } dist = ([character1].Head.Position - [character2].Head.Position).magnitude dmg = -((damage.max-damage.min)/(dmgRange.max-dmgRange.min))(dist-dmgRange.min) + damage.max [character1] and [character2] are placeholders for the hierarchies of two arbitrary characters. The error refers back to the line in which I define the variable "dmg."
Report Abuse
EvanHolt is not online. EvanHolt
Joined: 06 Sep 2008
Total Posts: 1264
10 Mar 2017 09:57 PM
Filters... Let me try again.

What does the error "Attempt to call a number value" mean? This is the code causing it:

damage = {
max = number1,
min = number2
}
dmgRange = {
max = number3,
min = number4
}
dist = ([character1].Head.Position - [character2].Head.Position).magnitude

dmg = -((damage.max-damage.min)/(dmgRange.max-dmgRange.min))(dist-dmgRange.min) + damage.max

[character1] and [character2] are placeholders for the hierarchies of two arbitrary characters.

The error refers back to the line in which I define the variable "dmg."

[ George Orwell taught me math! 2 + 2 = 5 ]
Report Abuse
EvanHolt is not online. EvanHolt
Joined: 06 Sep 2008
Total Posts: 1264
10 Mar 2017 09:58 PM
Make up whatever numbers you want for number1, number2, number3, and number4. The error occurs regardless.

[ George Orwell taught me math! 2 + 2 = 5 ]
Report Abuse
EvanHolt is not online. EvanHolt
Joined: 06 Sep 2008
Total Posts: 1264
10 Mar 2017 10:38 PM
Bump

[ George Orwell taught me math! 2 + 2 = 5 ]
Report Abuse
BlupoV2 is online. BlupoV2
Joined: 12 Nov 2012
Total Posts: 543
10 Mar 2017 10:41 PM
"dmg = -((damage.max-damage.min)/(dmgRange.max-dmgRange.min))(dist-dmgRange.min) + damage.max"

Lua interprets "-((damage.max-damage.min)/(dmgRange.max-dmgRange.min))(dist-dmgRange.min)" as a function call because of the way it's written.

It should be "-((damage.max-damage.min)/(dmgRange.max-dmgRange.min)) * (dist-dmgRange.min)" if you're trying to multiply it.
Report Abuse
EvanHolt is not online. EvanHolt
Joined: 06 Sep 2008
Total Posts: 1264
10 Mar 2017 11:13 PM
Oh whoops. Thanks!

[ George Orwell taught me math! 2 + 2 = 5 ]
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