Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

function onClicked() for Text Appear?

Asked by 6 years ago

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.

0
The Text must be in PlayerGui in a ScreenGui, also have an indent where the code is. shadow7692 69 — 6y
0
Where is the ClickDetector located? Nowaha 459 — 6y
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 lukeb50 631 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

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!

0
Thanks! I'll see if this works. Thanks for making it simple :) aquadrious 53 — 6y
0
No problem! :) PyccknnXakep 1225 — 6y
Ad

Answer this question