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

How do I make different eyes appear on every other mouse click?

I'm making a customization gui and I'm trying to make different eyes or anything in general appear after more than one mouse click. Here's what I got so far but it isn't really working.

local eyes = {"Eye1","Eye2","Eye3","Eye4","Eye5","Eye6","Eye7","Eye8","Eye9"};
local CurrentEye = 1;
local GoUp = game.Players.LocalPlayer.PlayerGui.CustomizationGui.FaceGui.ArrowEyes2
GoUp.MouseButton1Click:Connect(function()
	if (CurrentEye) + 1 > #eyes then
		CurrentEye = 1;
		
	else
		CurrentEye = CurrentEye +1;
		
	end
end)


1 answer

✓ Accepted answer

I showed you how to do this on Discord. Inside of the array, have the decals of the eyes.

When goUp is pressed, add to the currentEyes value if it's less than the max number of eyes, then load that decal in.

When goDown is pressed, SUBTRACT from the currentEyes value if it's greater than 0, then load THAT decal in.

```lua
local eyes = {"eye1ID", "eye2ID", "and so on"}; -- add decals here
local currentEye = 1;

goUp.MouseButton1Click:Connect(function()
if(currentEye + 1) > #eyes then
currentEye = 1;
-- set eye here. You can get decal VIA eyes[currentEye]
local cEyes = eyes[currentEye];
-- just create a new decal and set it's Texture to cEyes, then parent it to the character's head
else
currentEye = currentEye + 1;
-- set eye here. You can get decal VIA eyes[currentEye]
local cEyes = eyes[currentEye];
-- just create a new decal and set it's Texture to cEyes, then parent it to the character's head
end
end)

goDown.MouseButton1Click:Connect(function()
if(currentEye  - 1) == 0 then
currentEye = #eyes;
-- set eye here. You can get decal VIA eyes[currentEye]
local cEyes = eyes[currentEye];
-- just create a new decal and set it's Texture to cEyes, then parent it to the character's head
else
currentEye = currentEye - 1;
-- set eye here. You can get decal VIA eyes[currentEye]
local cEyes = eyes[currentEye];
-- just create a new decal and set it's Texture to cEyes, then parent it to the character's head
end
end)```

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