Part to Enable Gui Not Working

I want to make a gui that changes the text on a label when you touch a brick. Here is my script.

	local humanoid = part.Parent:FindFirstChild("Humanoid")
	if humanoid then
		local guiEnabled = game.StarterGui.BlackScreen.Enabled
		local text = game.StarterGui.BlackScreen.text.Text
		guiEnabled = true
		text = "potato e"


It prints “e” but doesn’t enable the gui or change the text. What’s wrong? I feel like it should work. I’ve tried making it a local script, and changing it around a little bit, but nothing worked.

I just want to know what’s wrong.


You are changing the Gui in starterGui.
StarterGui is the Gui that sits on the server and gets cloned to the player when they join. If you want to change the current players Gui, if it’s a local script you need to do LocalPlayer.PlayerGui or if its a Server Script:

local Player  = game.Players:GetPlayerFromCharacter(humanoid.Parent)
1 Like

Thanks for helping me! This was really helpful! Also thanks @Wizard101fire90 for instead of giving me the script, telling me how to do it so that I can learn!