the script works but it flood my output . how can i fix that
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
game:GetService("RunService").RenderStepped:Connect(function()
for i, part in pairs(character:GetChildren()) do
if string.match(part.Name, "Arm") or string.match(part.Name, "Leg") then
part.LocalTransparencyModifier = 0
end
end
end)
This script should not flood your Output unless its throwing an Error, But One Asnwer is to create a form of Whitelist to check whether something can be used for not, typically like this:
local Whitelist = {
-- the boolean is so you can choose to enable/disable it
-- also im lazy, and do not want to perform another loop
-- when you can do this
["Left Arm"] = true;
["Right Arm"] = true;
["Left Leg"] = true;
["Right Leg"] = true;
}
The Table will have these Names as an Index, and you will need to call them exactly how they are spelled (so make sure you spell what you want right.), you can then check whether you are getting the Part you want using this.
if Whitelist[part.Name] then -- if the index exists
-- if spelled correctly, or if the index is found, should be true
part.LocalTransparencyModifier = 0
end
Second Answer is to ensure the Object you have, has the Property you want to change.
The Only Reason I see that you would get an Error here is if string.match() found a matching pattern on another object, to Prevent this, make sure you check its class by using :IsA(), Since we are trying to look for the Players Limbs, its best to use BasePart, to refer to all Parts.
if part:IsA("BasePart") then
part.LocalTransparencyModifier = 0
end