I don't know what I'm doing wrong. It works flawlessly in Studio, but doesn't do anything (let alone printing a string) while Online.

What I'm trying to accomplish is if the script finds a model with a folder named "Appearance," it'll change the model's parts' brickcolor to the value of the brickcolorvalue (Appearance.SkinColor.Value)

I'm trying to experiment with things, so the following code may look weird to some.

Document = game.ReplicatedStorage:FindFirstChild("Doc")
Camera = workspace.CurrentCamera

while wait(.5) do -- "refresh" every .5 seconds
	for index, value in pairs(Camera:GetChildren()) do
		if value:IsA("Model") then
			local Appearance = value:findFirstChild("Appearance")
			if Appearance then
				print'a'
				for index, skin in pairs(value:GetChildren()) do
					if skin:IsA("Part") then
						skin.BrickColor = Appearance.SkinColor.Value
					end
				end
			elseif not Appearance then
				print'o'
			end
		end
	end
end

3 comments

0

I forgot to mention that this is in a server script

1

CurrentCamera is an object for each player, it works only in local scripts.

0

ahhhh thanks!!!