Whats the correct usage?
Should you be doing local target = nil or local target =? What do you do? (Proper Usage)
Should you be doing :connect() or :Connect()? (Capitalizations)
Why you should use:GetService() not game.ServerYouWant? (Proper Usage)
Should you be doing local target = nil or local target =? What do you do? (Proper Usage)
Should you be doing :connect() or :Connect()? (Capitalizations)
Why you should use:GetService() not game.ServerYouWant? (Proper Usage)
Real quick because I’m stupid and totally forgot how to do it:
Best way to send parameters between serverside scripts?
EDIT: Bindable events
No, Should you be doing local something = nil or local something
connect is deprecated so normally I use Connect to be on the safe-side. I also use local target = nil because it is easier for me to put a line of code to make sure it is still or not nil.
Personal preference.
Both local foo = nil and local foo both declare a variable foo equal to nil until another assignment.
I don’t believe all these come down to personal preference, as it will harm development later, especially when working modifying other programmers code.
local something - This is shorter to write and much cleaner.
:Connect() - The lower-case method is deprecated, you probably won’t be in much trouble for using connect, but it’s good practice to use uppercase
:GetService() - Service names can be changed before and during runtime
I’ve recategorised this to Scripting Support since this isn’t quite a broad topic about the art of developing on the Roblox platform: better belongs here. I have also changed the title to be more clear on your question. Please try and keep Discussion only for significant topics that invoke deep thinking and discussion rather than for quick Q&As or anything short that’d better belong in a support category.
These are my methods:
local target
because it’s shorter and the word nil looks ugly and i hate typing it
Event:Connect()
because capitalized words are the best (also :connect() is deprecated)
:GetService()
because when you use :GetService(), it gets your service regardless of what the name actually is.
for instance, lets say you named the ReplicatedStorage to “1738”
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--Gets ReplicatedStorage
local ReplicatedStorage = game.ReplicatedStorage
--Doesnt work because there's no child named ReplicatedStorage
plus you look smarter using it
I can’t say this is the proper way to use these methods. I’m just using the methods that make me more comfortable
Recently, the api-reference of this method was updated and it states some good points - specifically:
and can also be used for services that have unusual names, e.g. RunService’s name is “Run Service”.