I am making a Soup bowl that has a click detector,
I am trying to make a TextLabel Pop up on the player who clicked the Click Detector
then It disappears after around 10 seconds
How would I got about getting getting the script to find who clicked it, then make a TextLabel Show?
You could make a local script in StarterPlayerScripts, use MouseClick to check when the player clicks, then change the transparency of the TextLabel.
First question: “How would I go about getting the script to find who clicked?”
Answer: You can write game.Players.LocalPlayer to return the client that clicked the clickdetector. You could also use the first parameter in the MouseClick event which is the player that clicked.
Second question: “Make a TextLabel show?”
Answer: You can have a premade TextLabel in the StarterGui and change the transparency of that when the clickdetector is clicked.
I am pretty sure that it should be MouseClick, not mouseClick. Also is the local script inside the Soup GUI? It should be in StarterPlayer or inside the Tool.
A ClickDetector passes the player who clicked it as an argument. Alternatively, if you’re working with a LocalScript, you can access the property game.Players.LocalPlayer.
In terms of handling a local Gui, I would handle the ClickDetector from a LocalScript in (Starter)PlayerScripts, since you reasonably don’t need to connect more than once to this event. From this LocalScript, you can edit the Gui in the player’s PlayerGui.
Obviously don’t write it like the above since this is rough and bad code, but it gives you a perspective on how you can do this or what pathways become accessible to you.
Editing the Gui in StarterGui will do nothing because the contents of StarterGui merely exist to be copied to the player’s PlayerGui on each spawn provided ResetOnSpawn isn’t false, it’s not the actual display that you see on-screen.
@YourKitDev That’s irrelevant. Lowercase connect is only deprecated in favour of keeping uppercase conventions for methods. You should still use Connect for consistency and good practice of not using deprecated items, but that doesn’t matter here.