What is wrong here?

There is no reason on why it should Not be used

It’s slower, as mentioned in all three of the sources I’ve provided.

another one as i said
this should be used if it doesnt error and in most cases should be put Globals at the start
and only in functions the locals
i never said locals cant be at the start
but globals are better at doing that

maybe remove the local ?

You suggested that they should ‘maybe remove the local’ even though doing so wouldn’t fix the issue.

so how do you call 3 diffrent sites that say the same thing official since its only 1

Because they’re three independent sources written by different authors.

1 Like

ive never seen a delay problem based on a variable

of corse but it isnt the only thing i suggested
but it would be better without a local at this exact script he shared

:wave: Hey there :wave:

If you want, you should totally make this a topic for debate on the devforum, if there is such a diverse opinion on the subject :slight_smile:

As for the script, when a remote event is fired, I am pretty sure the first argument is always the player (correct me if I am wrong :slight_smile:)

Edit: Forummer addressed this issue in post 7.

Let me know if this helps :slight_smile:

cool but this doesnt change that roblox could had easily copied the exact same thing since thats what they used and edit it a little with the extra features they have in their program
and the 2 roblox sites are just 1 legacy and 1 rework so there is no diffrence

Local variables are obtained faster than global variables because they’re integrated into the environment in which they were created. If possible, you should always use local variables over global variables, unless there’s a specific reason otherwise.

https://create.roblox.com/docs/scripting/luau/variables

Variables can have global or local scopes. They have global scope by default, but it’s almost always better to create them with local scope because Luau accesses local variables faster than global ones. To give a variable local scope, put the keyword local before a variable’s name when you assign a value to it. For more information on Scope in Luau, see Scope.

Copied and pasted?

‘Programming in Lua’ was authored by one of Lua’s creators.

2 Likes



yeah this is totally not a rework site roblox is trying to bring because the legacy site is so old
and the Develop - Roblox being really out dated for some reason

Just saying guys, the creator wants to know why his script isn’t working, not how many articles there are on global and local functions / variables. :slight_smile:

i have already responded to what he asked for
its just @Forummer that replied saying im completely wrong here
here is the reply for me too

it just seems like @ExoticBloxed has not seen it yet.