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
 

Changing Material

Previous Thread :: Next Thread 
Vitalityc is not online. Vitalityc
Joined: 02 Aug 2013
Total Posts: 302
21 Jul 2017 10:31 AM
script.Parent.ClickDetector.MouseClick:connect(function()
print(script.Parent.Material)
if script.Parent.Material=="Neon" then
print("is neon")
script.Parent.Material="Smooth Plastic"
script.Parent.PointLight.Enabled=false
else

print("is not neon")
script.Parent.Material="Neon"
script.Parent.PointLight.Enabled=true

end
end)

OUTPUT:
Enum.Material.Neon
is not neon
_______________________________
If the material is neon why is it going to the else part

I'm stuck
Report Abuse
qrushed is not online. qrushed
Joined: 10 Apr 2012
Total Posts: 587
21 Jul 2017 10:34 AM
try comparing it with the Enum?

If it does have comparability with strings try lower case?
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
21 Jul 2017 10:34 AM
Material is an Enum not a String?
Report Abuse
Vitalityc is not online. Vitalityc
Joined: 02 Aug 2013
Total Posts: 302
21 Jul 2017 10:43 AM
@LaeMVP I'm still basically learning so I don't really know enum and string.. I'm lost LOL
Report Abuse
qrushed is not online. qrushed
Joined: 10 Apr 2012
Total Posts: 587
21 Jul 2017 10:46 AM
There a different types of Data in Lua
Strings
Numbers
Functions
...
and UserData

ROBLOX defined a bunch of UserData types like:
Enums
Vector2s
Vector3s
UDims
UDim2s
...

You should get the picture, lel.

the list of different Enums is massive you can check it out on the wiki

You can often set Properties that want an Enum with string values because that's just user friendly... But it's suggested you just use the Enum values for everything.
Report Abuse
Vitalityc is not online. Vitalityc
Joined: 02 Aug 2013
Total Posts: 302
21 Jul 2017 10:50 AM
Oh I see, I'll test it out and see if I understood. I'll reply back again if I don't get it.
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