Simple Text Changing Script

Problem
I am trying to create a simple brick that when clicked, text appears at the bottom of your screen. I believe I have the script correct, but it might just not be working due to where it is located within the game. I have already tried editing the code, but no errors occur.

Here is the script:

function onClick()

game.StarterGui.BottomText.Frame.TextLabel.TextTransparency = 0
game.StarterGui.BottomText.Frame.TextLabel.Text = ("The handle appears to have been removed...")
wait(1)
game.StarterGui.BottomText.Frame.TextLabel.TextTransparency = 0.3
wait(0.5)
game.StarterGui.BottomText.Frame.TextLabel.TextTransparency = 0.8
wait(0.2)
game.StarterGui.BottomText.Frame.TextLabel.TextTransparency = 1

end

game.Workspace.NoDoorHandle.ClickDetector.MouseClick:Connect(onClick)

This is the workspace:
image

Thank you for any help you may have. :slight_smile:

3 Likes

Starter GUI replicates to players when they join/respawn depending on the ResetOnSpawn property, meaning that any change you make to objects in starter GUI don’t actually occur to the player(s). To achieve what you’re wanting to do, you’re going to want to use a local script within the gui itself.

2 Likes

Then how would I be able to connect that change to an onclick function within the workspace?

You’d just do it in a local script in the screen GUI. The only difference is the way you define the button.

7 Likes

For future reference, you should know that changing properties in the StarterGui will not do anything. Instead, you should get the player (click detector has a player arguement) and do Player.PlayerGui.ScreenGui with the screen gui’s name replacing ‘ScreenGui’.

2 Likes

That will not work either as clients player GUI is not replicated to the server.

I’m aware, I’m just simply saying if he has a use for that (say for example cloning a gui) then he would use that. You can actually create UI instances on the server.

I’m simply clarifying the replication boundary. I am well aware of the ability to clone UI objects into a players gui. Your code did not imply that you had cloned an object.

Player.PlayerGui.ScreenGui -- no predefined variable or clone method