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: Need help with Getting Color3 from table

Previous Thread :: Next Thread 
mastermarkus is not online. mastermarkus
Joined: 18 Dec 2009
Total Posts: 95
31 Aug 2016 05:00 PM
Choices = {'New','Import','Export'}


local ChoiceColors = {
['New'] = Color3.new(85, 255, 127),
['Import'] = Color3.new(0/255,0/255,0/255),
['Export'] = Color3.new(0/255,0/255,0/255),
}

for i,choice in pairs(Choices) do
button = ...i have it defined already no problem
button.TextColor3 = ChoiceColors[choice]
end

i want to do it without writing bunch of if statement's, but its throwing me and error:
attempt to index local 'Color3' (a function value)

How would i fix this?
Thanks
Report Abuse
badfitz67 is not online. badfitz67
Joined: 03 Jun 2010
Total Posts: 13165
31 Aug 2016 05:03 PM
try:
for i,choice in pairs(ChoiceColors) do
button = ...i have it defined already no problem
button.TextColor3 = choice
end



All these questions have driven me into existential angst and I find myself beginning to question myself and my motives
Report Abuse
mastermarkus is not online. mastermarkus
Joined: 18 Dec 2009
Total Posts: 95
31 Aug 2016 05:05 PM
No ur missing the point im first getting the choice from list and according to choice name im setting the choicebutton color from the ChoiceColors table
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
31 Aug 2016 05:06 PM
attempt to index local 'Color3'

are you 100% sure you did not name any function Color3?
Report Abuse
mastermarkus is not online. mastermarkus
Joined: 18 Dec 2009
Total Posts: 95
31 Aug 2016 05:12 PM
Yes i did , but now its saying trying to index Color3 a table value i removed the function called Color3.
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
31 Aug 2016 05:13 PM
you need to make sure that nothing else has the name of "Color3" and then use

Color3.fromRGB(r,g,b) to store them
Report Abuse
mastermarkus is not online. mastermarkus
Joined: 18 Dec 2009
Total Posts: 95
31 Aug 2016 05:19 PM
Okey this is my code now and i dont' have anything named Color3 how would i make this work?

Its saying:attempt to call global 'Color3' (a table value)

local ChoiceColors = {
['New Animation'] = Color3.fromRGB(85/255, 255/255, 127/255),
['Import'] = Color3.fromRGB(0/255,0/255,0/255),
['Export'] = Color3.fromRGB(0/255,0/255,0/255),
}

for i,choice in pairs(Choices) do
button = ...i have it defined already no problem
button.TextColor3 = ChoiceColors[choice]
end

Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
31 Aug 2016 05:20 PM
attempt to call global 'Color3'

because you are doing

Color3()

somewhere

i dont know why you are -.-
Report Abuse
mastermarkus is not online. mastermarkus
Joined: 18 Dec 2009
Total Posts: 95
31 Aug 2016 05:22 PM
It's not i deleted the function called Color3, i think the problem now is it doesn' tseem to get the color3 value from the table
Report Abuse
mastermarkus is not online. mastermarkus
Joined: 18 Dec 2009
Total Posts: 95
31 Aug 2016 05:42 PM
Never mind got it, did call color3 lol thanks for help
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