Why is this GUI enabler button not working?

do you have local scripts in every gui button? because instead what you should do is to use 1 script to check if any of the parts are clicked and enable the gui based on what part it is

I’ve fixed this issue already and this wouldn’t matter as the function isn’t firing either way. I will post an updated script in a sec.

wait is this the code inside of that localscript?

The parts are deleted for optimisation and general ‘you found it’ stuff. Also it wouldn’t matter if every gui button had a local script as it’s the part/button scripts i have an issue with?

its better you use 1 script than multiple as it makes the game more simple that was just a side note

That local script is inside the part?

Updated Script:
local PlayerGui = game:GetService("Players").LocalPlayer.PlayerGui
local FaceButton = game.PlayerGui.FaceSelection.Frame.FaceButton
local FaceIcon = game.ReplicatedStorage.Face1.Texture

game.Players.PlayerAdded:Wait(1)

script.Parent.Touched:Connect(function(BasePart)
	FaceButton.FaceEquip.Enabled = true
	FaceButton.BackgroundColour3 = Color3.new(0,1,0)
	FaceButton.Image = FaceIcon
	print("Touch Run")

	if FaceButton.Image == FaceIcon then
		print("Success")
		script.Parent:Destroy()
	end
end)

You are using StarterGui, which will not work. If this is an serversided script this will work. Here is an edit to your script that will work. ClickDetectors have a player argument that you can get from it.

local FaceIcon = game.ReplicatedStorage.Face1.Texture -- Set to face image in replicated


script.Parent.MouseClick:Connect(function(player)
    local PlayerGui = player.PlayerGui
    PlayerGui.FaceSelection.Frame.FaceButton.FaceEquip.Enabled = true
	PlayerGui.FaceSelection.Frame.FaceButton.BackgroundColor = Color3.new(0,1,0)
	PlayerGui.FaceSelection.Frame.FaceButton.Image = FaceIcon

	if PlayerGui.FaceSelection.Frame.FaceButton.Image == FaceIcon then
		print("Success")
		script.Parent.Parent:Destroy()
	end
end)

The scripts within the gui are small as well it’s just easier for me to sort out rather than having to use a whole script for it.

1 Like

What is in the output when you play the gam

wydm? what i was asking is if the code youre having problems with is in a disabled localscript

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

As i said before i switched the StarterGui to PlayerGui. I also don’t need the player argument for the ClickDetector?

As stated before the code im having an issue with is in the part button which is not a disabled localscript,

So no toutch eun or success correct

this part has a script to enable the localscript correct?

The part has the localscript im having issues with the function firing for which enables the localscript.

My issue is that the function is not firing.

Is the local script running? At all if your not sure put a print at the beginning of the function

a local script cant run inside of a part:

A LocalScript will only run Lua code if it is a descendant of one of the following objects:

therefore the localscript in the part isnt running which means it cant enable the localscript in the gui. also if you want to use a localscript like this then you should use the first script to clone the localscript and parent the clone to the player which will cause it to run

1 Like

Im so sorry i misunderstood to start put print(“starting”) after the function begins

Sometimes you dont get a error msg for smh