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

PROBLEM WITH CHANGING FACE ON CHARACTER ENTER SCRIPT?

Asked by 6 years ago
Edited 6 years ago

It seems that whatever I try, my script wont change the face of the player upon spawn. The script doesnt show any errors because it continues on after the command to change the face texture. I've tried destroying the face then adding a new one and changing the texture but neither work. On the other hand, I grabbed a few of those face changing blocks and they all worked perfectly fine with the same sort of script command I have here so I'm utterly confused. Problem isn't with the script.Parent.mouth part either cause I've checked it at least 20 times

game.Players.PlayerAdded:connect(function(player)

player.CharacterAdded:connect(function(character)

    character.CHARACTERRANDOM.Hair.Value = math.random(1,2)

    character.CHARACTERRANDOM.EyeColor.Value = math.random(1,6)

character.Head.face.Texture = script.Parent.mouth.Texture

    local nose = game.ReplicatedStorage.nose:Clone()

    nose.Parent = character.Head
0
I've also tried setting the face transparency to 1 but even that doesnt freaking work NikkoTheJesusMan 3 — 6y
0
Oh I know the issue. kittonlover101 201 — 6y
0
Lemme fix it. kittonlover101 201 — 6y

2 answers

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

Maybe try waiting using WaitForChild:

character:WaitForChild("Head").face.Texture = script.Parent.mouth.Texture

If it doesn't work tell me.

0
Didn't work, ill try and add the script to a different game space and see if that works tho cause I honestly have no idea why the script won't work NikkoTheJesusMan 3 — 6y
0
Yea its still not working NikkoTheJesusMan 3 — 6y
0
Maybe it's the face texture you're trying to switch to replace "script.Parent.mouth.Texture" to ("http://www.roblox.com/asset/?id=26434948") Unless you're 100% sure that's not it cause ik you've said you've checked it already so may not be but try it with the waitforchild maybe Optimalpokemon123 37 — 6y
0
Yea I dunno still. When I change the texture id it shortens it to "rbxassetid://26434948" so I don't know if that has anything to do with it. Also the waitforchild allows the script to work but the face still won't change. NikkoTheJesusMan 3 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

You got to name the math.random. You cant just do math.random, since it doesn't know what you mean. Unless you are doing it by numbers.

-------------=/Tables\=-------------
--HairTable
HairTable = {}
HairTable[1] = "Hair1" --Change to whatever you wanna call the hair.
HairTable[2] = "Hair2" --Change to whatever you wanna call the hair.
--EyeTable
EyeTable = {}
EyeTable [1] = "Eye1" --Change to whatever you wanna call the eye color.
EyeTable [2] = "Eye2" --Change to whatever you wanna call the eye color.
EyeTable [3] = "Eye3" --Change to whatever you wanna call the eye color.
EyeTable [4] = "Eye4" --Change to whatever you wanna call the eye color.
EyeTable [5] = "Eye5" --Change to whatever you wanna call the eye color.
EyeTable [6] = "Eye6" --Change to whatever you wanna call the eye color.



game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        character.CHARACTERRANDOM.Hair.Value = HairTable[math.random(1,2)]

        character.CHARACTERRANDOM.EyeColor.Value = EyeTable[math.random(1,6)]

        character.Head.face.Texture = script.Parent.mouth.Texture

        local nose = game.ReplicatedStorage.nose:Clone()

        nose.Parent = character.Head
    end)
end)
0
The problem wasn’t with the math.random part though cause the script works with it, the only problem is that I can’t get rid of the original face on spa- wait I think i found out the problem NikkoTheJesusMan 3 — 6y
0
wait nevermind still not working ... but what i was saying was the math.random isnt the problem, its just that I cant seem to get rid of or even change the player's face upon entry of the game NikkoTheJesusMan 3 — 6y
0
@NikkoTheJesusMan I am honestly just as confused as you are, man. I tried writing a similar script for my game and it didn't work. I tried doing a bunch of research and couldn't find the answer. I actually eventually gave up on changing the face, and just created a second head and put a decal on the second head. I then used a script to make the original head transparent and to weld the new head. lunatic5 409 — 6y
0
Yea I dunno.. I couldn't get the original script to work so I added a different script that was local where it just destroyed the face altogether and it worked so I suppose it's all good now. NikkoTheJesusMan 3 — 6y

Answer this question