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

Simple change character script won't work?

Asked by 4 years ago

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)
0
hey, mind giving the whole script? zadobyte 692 — 4y
0
that is the whole script Diyamund 0 — 4y
0
it's located inside of the select button for male Diyamund 0 — 4y
0
What is FemaleAvatar? Is it like a bool value? Maxwell_Edison 105 — 4y
0
yes, it is a boolvalue Diyamund 0 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

Ad

Answer this question