Is this type of localizing variables okay?

I dont know what are the terms or name on what you call this method but is it okay to localize variables in one local?(as in a group of variables stored into one local(?))

local ss,wp,rs,twes,bss,plr = game:GetService("ServerStorage"),
	game:GetService("Workspace"),
	game:GetService("RunService"),
	game:GetService("TweenService"),
	game:GetService("BadgeService"),
	game:GetService("Players")
local oa,tan = TweenInfo.new(18,Enum.EasingStyle.Linear),
	TweenInfo.new(2,Enum.EasingStyle.Linear) -- ast speed,swspd
local go = {Size = Vector3.new(200,200,200);Transparency = 1} -- dont mind
local t = script.T.Value -- dont mind 
local las,land,bfps,nf = wp.UFO.Plate.Laser, 
	wp.Lobby.Exterior.Landon, 
	wp.RocketPads.BFrame.MFrame, 
	wp.UFO.NF -- lasers,spaceshipb,BFramedestr,spawndestr,ufobadg
local expar,sw,cas,sfx = ss.ExplosionParticles.grane,
	ss.SEF.CPE,
	ss.Roku.Missile,
	ss.SoundE.exp -- exppartic,swave,ast,sound
local abs,lbs,ebs = 2124623315,2124618728,2124619174

That is a multiple assignment. I think that in this case it only harms readability. The fact that you had to put a comment to explain what the variables were only prove even more that it hurt readability. Use descriptive variable names, don’t write magic code, and you will be fine.

local ServerStorage = game:GetService("ServerStorage")
local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local BadgeService = game:GetService("BadgeService")
local Players = game:GetService("Players")

Something like this is much more readable already.

Not sure what these names mean here, so once more, proves that this isn’t a good idea.

expar could be something like explosion_particles, not sure about the rest.

1 Like

Hello Angrybirdcharacter!

This will not affect performance or activity. This is just the same as defining them seperately. This is just for you if you like to keep your scripts compact.

1 Like