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

Why is this script only changing the characters body color to black?

Asked by 6 years ago

I'm making a character customization GUI and when the player chooses his skin color I use a color3 value and a mousebutton1click to get change the value. Output also gives me nothing.

I tried using prints to find the error but everything works fine

LocalScript that changes the Color3 value

main = script.Parent
mainFrame = main.Frame
colorChosen = script.Parent:WaitForChild("Color")

for i,v in pairs(mainFrame:GetChildren()) do
    print("k")
    if v and v:FindFirstChild("TextButton") then
        v.TextButton.MouseButton1Click:connect(function()
            colorChosen.Value = v.TextButton.BackgroundColor3
            print("color changed")
            script.Parent.ColorChanger.Disabled = false
            mainFrame.Visible = false
            wait(1)
            script.Parent.ColorChanger.Disabled = true
        end)
    end
end

LocalScript that changes the body colors of the player

color = script.Parent.Color.Value

local character = game.Players.LocalPlayer.Character
while script.Disabled == false do   
    print("h")
        character["Body Colors"].HeadColor3 = Color3.new(color)
        character["Body Colors"].LeftArmColor3 = Color3.new(color)
        character["Body Colors"].LeftLegColor3 = Color3.new(color)
        character["Body Colors"].RightArmColor3 = Color3.new(color)
        character["Body Colors"].RightLegColor3 = Color3.new(color)
        character["Body Colors"].TorsoColor3 = Color3.new(color)
        wait(.1)
    end

1 answer

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

Try putting "Color3.new(color.Color)" because if "color" is a BrickColor, then it doesn't automatically convert itself to a Color3 just because it's in the parentheses. http://wiki.roblox.com/index.php?title=API:Color3 I hope this helped :)

0
its not a brickcolor its a color3value Godlydeathdragon 227 — 6y
0
Alright, then try "Color3.new(color.X / 255, color.Y / 255, color.Z / 255)" because Color3Values determine colors with numbers between 0 and 255, while as Color3.new expects numbers between 0 and 1. OnlineOne 0 — 6y
0
ohhh thanks i didnt know that! Godlydeathdragon 227 — 6y
Ad

Answer this question