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

Pet Color3 and Brickcolor not changing....?

Asked by
Yukogan 72
4 years ago
Edited 4 years ago

Hi. I'm making a game with cats. You can customize their colour. The output doesn't say anything but the color is not changing. I know some things are very weird in the code, but the only problem is color = BrickColor.new("White")

Here is the code:

    local playername = script.Parent.Player.Value
    local player = game.Players:FindFirstChild(""..playername.."")

    local leaderstatscolor = player:WaitForChild("leaderstats"):WaitForChild("Color")
    local color = script.Parent.BrickColor
    local colors = {"Gray" or "White"}

while true do
        local leaderstatscolor = player.leaderstats.Color
    wait(1)
    if leaderstatscolor.Value ~= "Gray" and leaderstatscolor.Value ~= "White" then
        print(leaderstatscolor.Value)
        leaderstatscolor.Value = "Gray"
        color = BrickColor.new("Dark stone grey")

        else 

         if leaderstatscolor.Value == "White" then
            print("Debug 2")
            color = BrickColor.new("White")
        --[[    if level.Value >= 3 then
                size = "4.612, 5.541, 6.236"
            end--]]
    end
end
end


here is the movement script ---> pet:

   local bodyPos = Instance.new("BodyPosition", newPet)
   bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)

   local bodyGyro = Instance.new("BodyGyro", newPet)
   bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)

   while wait() do
    bodyPos.Position = humRootPart.Position + Vector3.new(2, 2, 3)
    bodyGyro.CFrame = humRootPart.CFrame
   end

hope someone can help! :)

Yuri

1 answer

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

You set color as a variable. That would mean that you would be changing the variable, not the pet's BrickColor. Try this:

    local playername = script.Parent.Player.Value
    local player = game.Players:FindFirstChild(""..playername.."")

    local leaderstatscolor = player:WaitForChild("leaderstats"):WaitForChild("Color")   
    local colors = {"Gray" or "White"}

while true do
        local leaderstatscolor = player.leaderstats.Color
    wait(1)
    if leaderstatscolor.Value ~= "Gray" and leaderstatscolor.Value ~= "White" then
        print(leaderstatscolor.Value)
        leaderstatscolor.Value = "Gray"
       script.Parent.BrickColor = BrickColor.new("Dark stone grey")

        else 

         if leaderstatscolor.Value == "White" then
            print("Debug 2")
            script.Parent.BrickColor = BrickColor.new("White")
        --[[    if level.Value >= 3 then
                size = "4.612, 5.541, 6.236"
            end--]]
    end
end
end

Also, is the leaderstatscolor value a BrickColor value?

0
Thanks a lot! I'll try it. Yukogan 72 — 4y
0
It worked! Thank you so much! Yukogan 72 — 4y
0
No problem. youtubemasterWOW 2741 — 4y
Ad

Answer this question