My ui is not appearing

so, the issue is that i made code, and i when i play my game it doesnt show my ui.
this is the code:

local function onClick()
	local text_Gui = game:GetService("StarterGui").texty
	local text_name = text_Gui.FrameText.name

	text_Gui.Enabled = true
	text_name = "cat"
end


script.Parent.ClickDetector.MouseClick:Connect(onClick)

im new to roblox studio so uhh please don’t make fun of me if its just a silly problem.

3 Likes

you’re referencing the StarterGui not the player’s gui :sob:

also the text variable doesnt really work because you’re changing the variable but not the text value ykwim?

1 Like

so uhh ty for pointing out the text thingy lol but im not sure if my code is correct again:

local function onClick()
	local text_Gui = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
	local text_name = text_Gui.FrameText.name

	text_Gui.Enabled = true
	text_name.Text = "cat"
end


script.Parent.ClickDetector.MouseClick:Connect(onClick)

so is it right or no?

1 Like

First of all, is this a LocalScript or a ServerScript?

If this is being executed on a ServerScript, that is a VERY bad sign.

This should be ran on a LocalScript.

That’s not the way you code on the script, your script is incorrect. Tested it my self, Thanks for understanding what I truly know.

it is a LocalScript so i think it’s right