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

During Character Customization, Hat Added But Won't Remove?

I am creating a neat little project that is very ambitious for a poor scripter like myself. I am writing code for a character customization prompt that allows for the use of hats to be placed upon the character's head (whom is using an R15 rig.) The hat places on just fine, however, when I click the button again and the script checks to see if the hair is on, the hair just stays on and doesn't get removed. Here's the block of code I used:

Character = game.Workspace.IntroSequence.Character
MyCharacter = game.Players.LocalPlayer.Character
x = game.Lighting["rickshair"]:clone()

script.Parent.MouseButton1Down:connect(function()
	if MyCharacter:FindFirstChild("rickshair") ~= nil then
		Character["rickshair"]:destroy()
		MyCharacter["rickshair"]:destroy()
		x:clone()
		
	end
	
	if MyCharacter:FindFirstChild("rickshair")== nil then
	x.Parent = Character
		x.Parent = Character
	x.Parent = MyCharacter
		x.Parent = MyCharacter
	end	
end)

You may notice the "Character" and "MyCharacter" definitions. This is because in the character customization screen I use a different model than the actual player, but place accessories on both at the same time. Hopefully that concludes any confusion.

1 comment

0

wew so much deprecated stuff yay

1 answer

Character = game.Workspace.IntroSequence.Character
MyCharacter = game.Players.LocalPlayer.Character
x = game.Lighting["rickshair"]:Clone()

script.Parent.MouseButton1Down:Connect(function()
    if MyCharacter:FindFirstChild("rickshair") ~= nil then
        Character["rickshair"]:Destroy()
        MyCharacter["rickshair"]:Destroy()
        x:clone()

    end

    if MyCharacter:FindFirstChild("rickshair")== nil then
    x.Parent = Character
        x.Parent = Character
    x.Parent = MyCharacter
        x.Parent = MyCharacter
    end 
end)


4 comments

0

@hiimgoodpack lmao k

0

the only thing I see here is some corrections in my scripting. this.. doesn't really help.

0

@SupahZekrom Koolio

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