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

Trying to change screen gui text label how do you do it?

im trying to change a text label on a screen gui in starter gui when you click a part

here is the code

local Textlabelforthingy = game.StarterGui.ScreenGui.TextLabel

script.Parent.ClickDetector.MouseClick:Connect(function()
Textlabelforthingy.Text = "the part has been clicked" end

4 comments

0

can someone please help me

0

where is the player gui im new sorry

0

its when u playtest

0

k now its working

2 answers

Ok, so you don't use StarterGui, you use PlayerGui Here is the fix:

--Local Script.
local plr = game.Players.LocalPlayer
local Textlabelforthingy = plr.PlayerGui.ScreenGui.TextLabel

script.Parent.ClickDetector.MouseClick:Connect(function()
	Textlabelforthingy.Text = "the part has been clicked" 
end

It is because you are changing it in StarterGui you need to change it in the Player Gui

script.Parent.ClickDetector.MouseClick:Connect(function(player)
	local Textlabelforthingy = player.PlayerGui.ScreenGui.TextLabel
	Textlabelforthingy.Text = "the part has been clicked"
end)

1 comment

1

thank you

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