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

BindableFunction returns color as black?

Asked by 5 years ago

This is meant to invoke after a person has clicked a color; which prints out the color3 perfectly fine; but when trying to change the Background color of a Frame it just makes it black and nothing else

--Invokes Server
for i,v in pairs(script.Parent.ColorUI.Colors:GetChildren()) do
    v.MouseButton1Click:connect(function()
        script.Parent.GetColor:Invoke(v.bColor.Value)
    end)
    v.MouseEnter:connect(function()
        script.Parent.ColorUI.CurrentColor.Text=v.Name
        script.Parent.ColorUI.CurrentColor.TextColor3=v.Color3.Value
    end)
    v.MouseLeave:connect(function()
        script.Parent.ColorUI.CurrentColor.Text=""
    end)
end

--Waits Invoke
local Path_to_GetColor = script.Parent.GetColor
Path_to_GetColor.OnInvoke = function(ReturnedColor)
    local choice = math.floor(ReturnedColor.Color.r*255)..", "..math.floor(ReturnedColor.Color.g*255)..", "..math.floor(ReturnedColor.Color.b*255)
    local g1 = script.Parent
    local a1 = g1.APBack
    local b1 = g1.Back
    local hb1 = g1.HealthBack
    local t1 = g1.Target

    print(choice)
    --ApBack
    a1.Bar.BackgroundColor3 = Color3.fromRGB(choice)
    a1.DecorLine.BackgroundColor3 = Color3.fromRGB(choice)
    a1.DecorLine2.BackgroundColor3 = Color3.fromRGB(choice)
    a1.DecorLine3.BackgroundColor3 = Color3.fromRGB(choice)
    a1.Label.TextColor3 = Color3.fromRGB(choice)

I'm not quite sure where an error is but I would assume it's the wait for invoke. Any help would be appreciated.

0
Color3 expects three numbers, and you gave a single string value. User#19524 175 — 5y
0
And you aren't returning any values from the BindableFunction, you should use a BindableEvent. User#19524 175 — 5y
0
I will try that! Thank's for the help. IrishStukov 20 — 5y
0
Yeah I tried that- it still returns black IrishStukov 20 — 5y

Answer this question