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

Why won't this change?

Asked by 8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
lastSpawn = nil
faces = script.Parent.Parent.Parent.Pants:GetChildren()--folder with lots of string values
Face = script.Parent.Parent.Parent.Dummy.Head.Face.Texture--face

script.Parent.MouseButton1Click:connect(function()

repeat

    curSpawn = faces[math.random(1,#faces)]

    until curSpawn ~= lastSpawn

    lastSpawn = curSpawn

    wait() --Let the Character fully load

    Face = curSpawn.Value 

end)

So I have this gui and I am using 3D Module, I want to make a button that press like press the button face I want it to random generate a random face. So there isn't error showing up BUT the texture of the face doesn't change and also how can I make the 3D module change too.

1 answer

Log in to vote
0
Answered by 8 years ago

The reason it doesn't change is because you can't assign properties to variables. To fix this, you should change it to the following:

lastSpawn = nil
faces = script.Parent.Parent.Parent.Pants:GetChildren()--folder with lots of string values
Face = script.Parent.Parent.Parent.Dummy.Head.Face--face

script.Parent.MouseButton1Click:connect(function()

repeat

    curSpawn = faces[math.random(1,#faces)]

    until curSpawn ~= lastSpawn

    lastSpawn = curSpawn

    wait() --Let the Character fully load

    Face.Texture = curSpawn.Value 

end)


I'm not sure if there are any other errors with this, but I cannot see any.

Unfortunately, I am unable to help you with this '3D Module', however.

Ad

Answer this question