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

viewmodel check for clothes won't update the viewmodel, any help?

I made a little script that checks every frame if the player's character has any body colors, or a shirt on their character. It doesn't seem do actually be working though, if anybody can help it would be very appreciated.


function checkViewmodel(plr,char,playerviewmodel)
	if char then 
		if not playerviewmodel:FindFirstChild("Shirt") or not playerviewmodel:FindFirstChild("Body Colors") then
			for i,v in pairs(char:GetChildren()) do
				if v:IsA("Shirt") or v:IsA("BodyColors") then
					local item = v:Clone()
					item.Parent = playerviewmodel
				end
			end
		end
	end
end


game:GetService("RunService").RenderStepped:Connect(function()
	checkViewmodel(player,character,PlayerView)
end)


4 comments

0

This is done through a local script by the way, the player, character, viewmodel, etc already have a variable attached to it

0

Ok, the script is actually working. Are you sure that you are waiting for the character and not just instantly assigning it?

0

My current best guess is that you made a mistake when assigning the variables

0

is there a way i can wait for the player's character? because i've tried a lot of different things and this was the cleanest way i could think of doing it

1 answer

✓ Accepted answer
local character = player.Character or player.CharacterAdded:Wait()

If you do not wait for the character, the value is nil

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