Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Pet Color3 and Brickcolor not changing....?

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

✓ Accepted answer

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?

3 comments

0

Thanks a lot! I'll try it.

0

It worked! Thank you so much!

0

No problem.

This discussion is preserved as it was. New answers, comments, and votes are closed.