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

Simple change character script won't work?

Hi, I'm making a game, and I have a StarterCharacter set, and I have a GUI to change the gender of the character. The button for female works fine, but the button for male doesn't work at removing assets from the female avatar.

Video example:

https://youtu.be/M2PWZLBzOjY

The Script in question (Not a LocalScript):

local plr = script.Parent.Parent.Parent.Parent.Parent

script.Parent.MouseButton1Click:connect(function()
	if plr.FemaleAvatar == true then
		plr.Character:WaitForChild("Hair"):Destroy()
		plr.Character.Head.face.Texture = "rbxasset://textures/face.png"
		plr.FemaleAvatar = false
	end
end)

5 comments

0

hey, mind giving the whole script?

0

that is the whole script

0

it's located inside of the select button for male

0

What is FemaleAvatar? Is it like a bool value?

0

yes, it is a boolvalue

1 answer

✓ Accepted answer

Ah, simple mistakes. It's fine tho, you just forgot the value part.

local plr = script.Parent.Parent.Parent.Parent.Parent

script.Parent.MouseButton1Click:Connect(function()
    if plr.FemaleAvatar.Value == true then
        plr.Character:WaitForChild("Hair"):Destroy()
        plr.Character.Head.face.Texture = "rbxasset://textures/face.png"
        plr.FemaleAvatar.Value = false --//When you have a global value, you need to add that .Value
    end
end)

Lemme know if you have some errors

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