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 » Scripting Helpers
Home Search
 

Re: s

Previous Thread :: Next Thread 
ClownVomit is not online. ClownVomit
Joined: 29 Dec 2010
Total Posts: 136
04 Jun 2012 08:34 PM
I have this script that changes the name of a model by the value of an IntValue named health. So. Say the model's name is [25], that is because the IntValue i have in a seperate location is 25. My plan was, that when the IntValue decreased, it changed the name of the Model. Example.

IntValue = 25
model name = 25
-1
IntValue = 24
model name = 24
-1
IntValue = 23
model name = 23

I know the IntValue is decreasing, but the model name isnt changing. My script is

while true do
script.Parent.Name = ""..script.Parent.Parent.Door.Door1.Health.Value..""
return
end

This works. I know it works because when i go into a game, the model name changes to 25, but as the IntValue decreases, the model name doesn't. What is wrong?
Report Abuse
ElectricAxel is not online. ElectricAxel
Joined: 15 May 2009
Total Posts: 16239
04 Jun 2012 08:36 PM
script.Parent.Parent.Door.Door1.Health.Changed:connect(function()
script.Parent.Name = tostring(script.Parent.Parent.Door.Door1.Health.Value)
end)

Just to make it more efficient, as for the name, try checking if its script.Parent.Parent instead of script.Parent...?
Report Abuse
Cachinnation is not online. Cachinnation
Joined: 21 Aug 2011
Total Posts: 1797
04 Jun 2012 08:37 PM
You can't set variables as numbers.
Report Abuse
ElectricAxel is not online. ElectricAxel
Joined: 15 May 2009
Total Posts: 16239
04 Jun 2012 08:39 PM
Wait what?
Report Abuse
Cachinnation is not online. Cachinnation
Joined: 21 Aug 2011
Total Posts: 1797
04 Jun 2012 08:40 PM
I don't remember variables owning the capability of having a number set to it.
Report Abuse
ElectricAxel is not online. ElectricAxel
Joined: 15 May 2009
Total Posts: 16239
04 Jun 2012 08:41 PM
Hello1HowAreYou = "trololol?"

print(Hello1HowAreYou)

As long as the first character is not a number its fine...
Report Abuse
Cachinnation is not online. Cachinnation
Joined: 21 Aug 2011
Total Posts: 1797
04 Jun 2012 08:43 PM
no no I mean this:

variable = 1

print(variable)
Report Abuse
ElectricAxel is not online. ElectricAxel
Joined: 15 May 2009
Total Posts: 16239
04 Jun 2012 08:43 PM
Actually:


getfenv()["1234Trololol"] = "Trolling with dem mindz"
print(getfenv()["1234Trololol"])
Report Abuse
bananacupcake is not online. bananacupcake
Joined: 15 Jun 2010
Total Posts: 571
04 Jun 2012 08:45 PM
modelname = IntValue

IntValue = 25
modelname = IntValue
wait(1)
IntValue = 24
modelname = IntValue
wait(1)

Like that?

There are other ways to do this, but this is the simple way.
Report Abuse
ElectricAxel is not online. ElectricAxel
Joined: 15 May 2009
Total Posts: 16239
04 Jun 2012 08:45 PM
._. Really?

Number is one of the data types, print(type(1)) will prove this. You can store anyyyyyyyyything in variables as long as it exist (or even if it doesn't, proven by a = nil print(a) print(type(a))). So yeah, you can store numbers in variables...

a = 1
b = 2
c = a + b
print(c)
Report Abuse
ClownVomit is not online. ClownVomit
Joined: 29 Dec 2010
Total Posts: 136
04 Jun 2012 08:50 PM
@Ele, worked thanks bro. :)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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