New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Why Gui background color3 became a userdata value?

Asked by 1 year ago

I've worked on Roblox studio for about a few weeks. My script is like this:

repeat wait() until game.Loaded local But = script.Parent function Clicked() for i = 1,255,1 do But.BackgroundColor3 = But.BackgroundColor3 + Color3.new(i,0,0) wait(0.01) end But.BackgroundColor3 = Color3.new(0,0,0) end But.MouseButton1Click:Connect(Clicked)

And the error output:

......attempt to perform arithmetic on field 'BackgroundColor3' (a userdata value)

What happened? Please help me.

0
Also, Color3.new() only takes numbers from 0 to 1. Use Color3.fromRGB() instead. DeceptiveCaster 2794 — 1y
0
You are dumb aaaaaa robloxwhiz User#24403 26 — 1y

1 answer

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

The script doesn't know what color format you want to use,

if you're using RGB then you must put Color3.fromrgb like here

But.BackgroundColor3 = Color3.fromrgb(0,0,0)
0
Ok thanks DERP9487 41 — 1y
Ad

Answer this question