Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Anybody know how to remove hair or make it transparent??

Asked by 8 years ago

So I'm making an ssj script for a game and can't figure out how to make the hair transparent or just remove it. Please help ;-;

This is what I have tried:

1--This is a local script in the StarterPack
2local jun = script.Parent.Parent
3if jun.Character:FindFirstChildofClass("Accessory") ~= nil then
4local Hair = jun.Character:FindFirstChildofClass("Accessory")
5Hair.Handle.Transparency = 1
6end
0
It's nice to see a fellow DBZ fan. :) TheeDeathCaster 2368 — 8y
0
:3 animelover6446 41 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Hey there! The issue is that your 'jun' pointer was to 'Players.Player1', which does not include the player's model. A quick solution that keeps the same premise as the script you've given us to work with is as follows:

01--This is a local script in the StarterPack
02 
03local playerIndex = script.Parent.Parent.Name;
04local player = workspace:WaitForChild(playerIndex);
05 
06for _, accessory in pairs(player:GetChildren()) do
07    if (accessory.ClassName == "Accessory") then
08        accessory.Handle.Transparency = 1;
09    end
10end

Essentially, we find the local player's name and index it in the workspace using the :WaitForChild(string 'childName') method, and then looping through the player's model, setting the transparency of all accessory objects to 1.

Hope this helps!

Ad

Answer this question