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

function onClicked() for Text Appear?

I want to make it that, upon click of a computer, text will appear (as an interaction.) I currently have a script but it doesn't seem to work at all. Any guidance?

function onClicked()
game.Players.LocalPlayer.PlayerScripts.ComputerText.Visible = true
wait(3)
game.Players.LocalPlayer.PlayerScripts.ComputerText.Visible = false
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

ComputerText is the name of the Frame that the text is held within.

3 comments

0

The Text must be in PlayerGui in a ScreenGui, also have an indent where the code is.

0

Where is the ClickDetector located?

0

This is a script that would be running on the server. I'm not sure of your FE setting but generally the server cannot change stuff inside the playergui, only the client

1 answer

✓ Accepted answer

I'm assuming you're trying to access the PlayerGui since you're using the property Visible.

script.Parent.ClickDetector.MouseClick:Connect(function(player) --Get the player who clicked
	local Gui = player.PlayerGui:WaitForChild("ScreenGui") --Whatever the GUI is called
	Gui.ComputerText.Visible = true
end)

Please accept my answer if this helped!

2 comments

0

Thanks! I'll see if this works. Thanks for making it simple :)

0

No problem! :)

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