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

Changing Transparency On R15 Character?

I'm trying to use R15 but the script just won't change it even though no errors? What am i doing wrong?

game:GetService("Players").PlayerAdded:Connect(function (player)
	player.CharacterAdded:Connect(function (character)
		local ghost = character:WaitForChild("RightHand")
		if (ghost) then
			ghost.Transparency = 1
		end
	end)
end)

6 comments

0

RIghtHand must not be a child. Are you playing in Studio and is the game published?

0

I tried publishing it yes and not sure how to re-write it without waitfor. The script is in server script server

0

are you trying to make 1 part transparent or multiple parts?

0

Just trying to make my RightHand Transparent , R15 Meshparts rig

0

You have to wait for the RightHand to finish loading, you could use repeat...until or wait a few seconds then do the commands

0

no need of the 'if' statement, since you are using WaitForChild() it is guaranteed that RightHand exists

2 answers

✓ Accepted answer

You need to use :FindFirstChild() when you are wanting a Bool Value result and you don't need any brackets when you are asking for a Bool Value and also, you need to add a wait after Characteradded to give the script time after the child is added

Here's a fixed Version for you

game:GetService("Players").PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
		wait()
		local ghost = character:FindFirstChild("RightHand")
        
		if ghost then
            ghost.Transparency = 1
        end
    end)
end)

2 comments

0

why do u need findfirstchild when using bool

0

This worked for me so not going to question it. I'm gonna try to study the different values on this. Thank you

Instead of using PlayerAdded, you can use a local script and place it in StarterCharacterScripts.

Inside a Local Script:

repeat wait() until game.Players.LocalPlayer
repeat wait() until game.Players.LocalPlayer.Character:IsDescendantOf(workspace) -- basically the same thing as characteradded
------------------------------------------------------------------------------------------------------------

local Player = game.Players:WaitForChild(game.Players.LocalPlayer.Name)
local Character = Player.Character

local HideAccessorys = true -- set this to true or false if you want the player's hats to be hidden or not

function GHOST()
	for _, v in pairs(Character:GetChildren()) do 
		if v:IsA('BasePart') then 
			v.Transparency = 1
		
		elseif HideAccessorys and v:IsA('Accessory') then 
			v.Transparency = 1
		end
	end
end

function SHOW()
	for _, v in pairs(Character:GetChildren()) do 
		if v:IsA('BasePart') then 
			v.Transparency = 0
		
		elseif HideAccessorys and v:IsA('Accessory') then 
			v.Transparency = 0
		end
	end
end

Make sure this is a LocalScript and place it in StarterCharacterScripts.

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