local findpart = game.ReplicatedStorage.folder:FindFirstChild(player.leaderstats.skin.Value)
The script format I wrote is like this.
But it’s not right because if write it like this, script is find the skin value.
I want to know how to make a script to find a part that has the same name as skin value Please help me!!
-- Assuming you have these variables set up:
local player = game.Players.LocalPlayer -- Change to the specific player you're interested in
local skinValue = player.leaderstats.skin.Value -- The value you want to match
local folder = game.ReplicatedStorage.folder -- The folder containing the parts
for _, part in pairs(folder:GetDescendants()) do
if part:IsA("BasePart") and part.Name == skinValue then
-- You found a part with the same name as the skin value
-- Do something with the part here
print("Found part with name:", skinValue)
print("Part's position:", part.Position)
end
end
^:
skinValue is set to the skin leaderstat value of the player you’re interested in.
You iterate through the descendants of the `folder’ (assuming you have one).
For each descendant, you check if it’s a BasePart (a part that has a name) and if its name matches the skinValue.
If a matching part is found, you can perform actions of the part.