Events:
In addition to properties and functions, every object also has events which can be used to set up cause-and-effect systems. Events send out signals when specific things happen in a game, such as a player touching an object or a player connecting to the game. To fire an event is to have it send out such a signal.
Functions:
A RemoteFunction is used to create in-game APIs that both the client and the server can use to communicate with each other. Like BindableFunction , a RemoteFunction can be invoked (called) to do a certain action and return the results.
A BindableFunction is a Roblox object that allows you to give access to functions to external scripts. Functions put in BindableFunctions will not be replicated, therefore making it impossible to use these objects to pass functions between scripts. Functions are invoked through BindableFunction:Invoke , which calls BindableFunction.OnInvoke .
ClickDetectors allow Scripts and LocalScripts to receive pointer input on 3D objects through their MouseClick event. They work when parented to BasePart, Model or Folder objects. They detect basic mouse events: enter, leave, left click and right click. Touch input on TouchEnabled devices also fires click events. The default control scripts bind the ButtonR2 KeyCode to interact with ClickDetectors using ContextActionService:BindActivate, which can also be used to override this. When using gamepads, the center dot triggers MouseHoverEnter/MouseHoverLeave. The bound activation button fires MouseClick.
If you put multiple scripts into Click Detectors, then it could cause some lag. There is a solution by only needing 1 script, using this method: https://www.lua.org/pil/7.3.html
Hey, could you help me again?
I want to know, should I use a event, or a BoolValue for this?
I want to make something (a ViewportFrame, to be exact) disappear when the loading screen disappears. What should I use?
It is unnecessary to make an event, in this case. In the script that makes the loading screen disappear, just locate the ViewportFrame and make it disappear.
A bit confused here. My script creates a ViewportFrame that is parented to a ScreenGUI. When I playtest the game, it shows up in PlayerGui. Where should I find that? I didn’t really get what you said by
-- When the loading screen is disabled
local player = game.LocalPlayer --Would this be correct?
local playerUI = game.player.PlayerGui
local viewportframe = playerUI.ScreenGui:WaitForChild("ViewportFrame")
viewportframe.visible = false
game.Players.LocalPlayer doesn’t work on server script.
If the below is a server script then tell me:
-- When the loading screen is disabled
local player = game.Players.LocalPlayer --Would this be correct? Yes.
local playerUI = player:WaitForChild(“PlayerGui”)
local viewportframe = playerUI.ScreenGui:WaitForChild(“ViewportFrame”)
viewportframe.visible = false
Yes, I made edits to mine. So I would just add the :WaitForChild()?
(Uhh… sorry for asking another question, but can you clarify on what :WaitForChild() does? I’m pretty sure it allows the script to wait for the thing to load or something, but I’m not sure)