Problem | Roblox Forum
Welcome to the Forums!
Join thousands of other Roblox members with a free account.
Create Forum Account

Problem

  • This website was created by Roblox members to replace the official forums because Roblox shut them down! Join our community if you like to talk about Roblox!

Nightmae

New Member
Jul 30, 2020
3
0
1
Roblox
AtsumuMatsuyukii
it always colors my skin to white. how i can fix it? i want to color it to any RBX color


game.ReplicatedStorage.Events.ColorEvent1.OnServerEvent:Connect(function(plr)
local Button = game.StarterGui.Menu.Frame1.SkinColor1

local q = BrickColor.new(237, 196, 179)
local char = plr.Character

char.Head.BrickColor = q
char.UpperTorso.BrickColor = q
char.LowerTorso.BrickColor = q
char.RightLowerArm.BrickColor = q
char.LeftLowerArm.BrickColor = q
char.RightUpperArm.BrickColor = q
char.LeftUpperArm.BrickColor = q
char.RightLowerLeg.BrickColor = q
char.LeftLowerLeg.BrickColor = q
char.RightUpperLeg.BrickColor = q
char.LeftUpperLeg.BrickColor = q
char.RightFoot.BrickColor = q
char.LeftFoot.BrickColor = q
char.RightHand.BrickColor = q
char.LeftHand.BrickColor = q
end)
 

CallMeKY

Moderator
Ultra
Feb 25, 2018
1,151
280
83
Maine, USA
Roblox
CallMeKY
Discord
CallMeKY#5012
it always colors my skin to white. how i can fix it? i want to color it to any RBX color


game.ReplicatedStorage.Events.ColorEvent1.OnServerEvent:Connect(function(plr)
local Button = game.StarterGui.Menu.Frame1.SkinColor1

local q = BrickColor.new(237, 196, 179)
local char = plr.Character

char.Head.BrickColor = q
char.UpperTorso.BrickColor = q
char.LowerTorso.BrickColor = q
char.RightLowerArm.BrickColor = q
char.LeftLowerArm.BrickColor = q
char.RightUpperArm.BrickColor = q
char.LeftUpperArm.BrickColor = q
char.RightLowerLeg.BrickColor = q
char.LeftLowerLeg.BrickColor = q
char.RightUpperLeg.BrickColor = q
char.LeftUpperLeg.BrickColor = q
char.RightFoot.BrickColor = q
char.LeftFoot.BrickColor = q
char.RightHand.BrickColor = q
char.LeftHand.BrickColor = q
end)

You just need to randomize the colors. You can also iterate through the character model with a loop. I just wrote this up real quick on my phone, but I don't think I messed anything up.
Code:
game:GetService('ReplicatedStorage'):WaitForChild('Events'):WaitForChild('ColorEvent1').OnServerEvent:Connect(function(player)
    local color = BrickColor.new(237, 196, 179)
    for _, object in pairs(player.Character:GetChildren()) do
        if object:IsA('BasePart') then
            object.Color = color
        end
    end
end)
 

Nightmae

New Member
Jul 30, 2020
3
0
1
Roblox
AtsumuMatsuyukii
it always colors my skin to white. how i can fix it? i want to color it to any RBX color


game.ReplicatedStorage.Events.ColorEvent1.OnServerEvent:Connect(function(plr)
local Button = game.StarterGui.Menu.Frame1.SkinColor1

local q = BrickColor.new(237, 196, 179)
local char = plr.Character

char.Head.BrickColor = q
char.UpperTorso.BrickColor = q
char.LowerTorso.BrickColor = q
char.RightLowerArm.BrickColor = q
char.LeftLowerArm.BrickColor = q
char.RightUpperArm.BrickColor = q
char.LeftUpperArm.BrickColor = q
char.RightLowerLeg.BrickColor = q
char.LeftLowerLeg.BrickColor = q
char.RightUpperLeg.BrickColor = q
char.LeftUpperLeg.BrickColor = q
char.RightFoot.BrickColor = q
char.LeftFoot.BrickColor = q
char.RightHand.BrickColor = q
char.LeftHand.BrickColor = q
end)

You just need to randomize the colors. You can also iterate through the character model with a loop. I just wrote this up real quick on my phone, but I don't think I messed anything up.
Code:
game:GetService('ReplicatedStorage'):WaitForChild('Events'):WaitForChild('ColorEvent1').OnServerEvent:Connect(function(player)
    local color = BrickColor.new(237, 196, 179)
    for _, object in pairs(player.Character:GetChildren()) do
        if object:IsA('BasePart') then
            object.Color = color
        end
    end
end)
error
ServerScriptService.Script:5: invalid argument #3 (Color3 expected, got BrickColor)
 

CallMeKY

Moderator
Ultra
Feb 25, 2018
1,151
280
83
Maine, USA
Roblox
CallMeKY
Discord
CallMeKY#5012
callmeky saved the day

My bad, I did forget to randomize the color and change BrickColor to Color. Writing code on a phone vs writing on Studio is a lot different lol. This should work as intended.
Code:
game:GetService('ReplicatedStorage'):WaitForChild('Events'):WaitForChild('ColorEvent1').OnServerEvent:Connect(function(player)
    local color = Color3.new(math.random(0, 255), math.random(0, 255), math.random(0, 255))
    for _, object in pairs(player.Character:GetChildren()) do
        if object:IsA('BasePart') then
            object.Color = color
        end
    end
end)
 
General
Help Users
    Arthurerywester Arthurerywester: and the premier is over