Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What is "workspace attempt to call a table value?"

I made this script to simulate a lightning effect, The atmosphere color would turn white for around 2 seconds at random every 8 seconds, but i keep getting the error "Script:9: attempt to call a table value

My original script

Loop = true
while Loop == true do
wait (8)
local RandomNumber = math.random (1,2)
print (RandomNumber)
if RandomNumber == 2 then 
	Lightning = true
	if Lightning == true then
			game.Lighting.Atmosphere.Color = Color3(255,255,255)
			wait (2)
			game.Lighting.Atmosphere.Color = Color3(88, 98, 122)
	Lightning = false	
	end
end
end

Ive Tried ,


	game.Lighting.Atmosphere.Color = Enum.Color3.new(1,1,1)
			wait (2)
	game.Lighting.Atmosphere.Color = Enum.Color3.new(0.345098, 0.384314, 0.478431)

1 comment

0

replace Color3 with Color3.new

1 answer

You create a new Color3 with Color3.new

game.Lighting.Atmosphere.Color = Color3.new(255,255,255)
wait (2)
game.Lighting.Atmosphere.Color = Color3.new(88, 98, 122)

For future reference, you can think of Enums as constants that Roblox gives you, so for example, Enum.KeyCode.E will always represent the letter E on the keyboard

2 comments

1

.fromRGB*, color3.new requires 255/num to get the color

0

oh yeah, good catch

This discussion is preserved as it was. New answers, comments, and votes are closed.