Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

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)
0
replace Color3 with Color3.new Speedmask 661 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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

1
.fromRGB*, color3.new requires 255/num to get the color greatneil80 2647 — 3y
0
oh yeah, good catch OfficerBrah 494 — 3y
Ad

Answer this question