Questions about setting amount of money in a player

I removed my topic by mistake but here’s the thing:Hello users again this time I have a strange problem. I’ve been doing a scirpt that involves the character having or not having charactermesh.
But the problem is that the buttons are not working properly, this only happened to me at the end because in the middle everything was fine.
I can’t really understand the problem and I also think I’m not specifying the problem well but here is the place.

This is valid support question regarding scripting. And correct category.

@funtimeandrefoxy Try this

while true do
wait()
c=game.Workspace:getChildren()
for i = 1, #c do
cc=c[i]:getChildren()
for ii=1, #cc do
if cc[ii].className=="CharacterMesh" then
--remove it if you want
--cc[ii]:Remove()
end
end
end
end
1 Like

Try using this: It doesn’t depend on the assumption that the character mesh parts already exist. It just searches the player character for meshes.

game.ReplicatedStorage.Events.RemoveCharacterMesh.OnServerEvent:Connect(function(player)
	local char = player.Character
	if (char and not char.Default.Value) then
		for _, c in ipairs(char:GetChildren()) do
			if (c:IsA("CharacterMesh")) then
				c:Destroy()
			end
		end
	end
end)
1 Like

if it was working halfway through theres a good chance that its syntax.

1 Like