Welcome to the Forums!
Join thousands of other Roblox members with a free account.
Create Forum Account

Can someone say what does the local means?

  • This website was created by Roblox members to replace the official forums (because Roblox shut them down) Join us if you like Roblox!
Status
Not open for further replies.

Nidal

New Member
Reputation: 0 / 0 / 0
May 1, 2021
20
3
3
Roblox
bot150052
Hello, Can someone explain me what does local means and how to doing it or something?
 

YS0

le person
VIP
Reputation: 1 / 0 / 0
Mar 19, 2021
1,044
4
1,037
113
abcdefghijklmnopqrstuvwxyz • male
Roblox
Dr_Fizzy
Discord
bdav #7155
it can be used to reference and for variables is
local part = game.workspace.part
or
local variable = 69 or something like that
it can also be used for localplayer, so something that happens to one player and one player only ie a localscript is used for an event to happen to 1 player

im not the best scripter but i hope this helps 👍
 

Nidal

New Member
Reputation: 0 / 0 / 0
May 1, 2021
20
3
3
Roblox
bot150052
it can be used to reference and for variables is
local part = game.workspace.part
or
local variable = 69 or something like that
it can also be used for localplayer, so something that happens to one player and one player only ie a localscript is used for an event to happen to 1 player

im not the best scripter but i hope this helps 👍
Thank you very much. Do you have discord so we can talk? We can help each other maybe? Actually I can't help because Im bad at scripting but I can ask you some question you know. So do you have discord so we can talk? If you don't want to its okay.
 

CallMeKY

Moderator
Ultra
Reputation: 6 / 0 / 0
Feb 25, 2018
1,701
84
848
113
Maine, USA
Roblox
CallMeKY
Discord
CallMeKY#5012
Hello, Can someone explain me what does local means and how to doing it or something?
In order to understand global and local variables, you first need to understand scope. I'd suggest reading through both of the embedded links. In a nutshell;

Lua:
local var = true -- defines global variable "var" as true (despite being "local", since it's defined in the global scope)

do
    print(var) -- will print true
    local var = false -- redefines global "var" true as local "var" false
    print(var) -- will print false
end

print(var) -- will print true, despite being set to false in the previous code block (since it was changed locally within the scope of the code block)

do
    var = false -- globally sets "var" as false
end

print(var) -- will print false, since it was changed globally despite being within the scope of the previous code block
 
Last edited:
Status
Not open for further replies.