Another fun thing you can do is to use semicolons to put multiple statements onto one line. Now you can format your code into cool and fun shapes!
This also prevents your code from erroring as often, as the Luau VM will think that your code is fun and will be entertained while reading it.
There seems to be an area that could be optimised in this part of your script. Instead of using local variables, it’s best to write them into a modulescript, like this:
This even allows you to import your variables into multiple scripts!
The script editor might complain that “THe varIabLE iS NOt defINEd!!”?!?!?!“?!$!!%^”, but this is simply because the editor is unable to comprehend the extreme performance and unthinkable power your code now holds.
also, make sure not to separate out your code into different modules and scripts!
Put your hunger system, your health system, your weapons system, your enemy AI, your animations player, and your round system logic all in the same master script.
this was really helpful, now my code looks like this
local workspace =script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Workspace --[[goes to workspace]]
local part = workspace.Part --[[ goes to part]]
local scriptt= part.Script --[[goes to this scirpt]]
if workspace then --[[finds worskpace]]
if part then -- [[fins prat]]
if scriptt then --[[[finds scripttt]]]]]
print("it worked yaaayydfsdf hasomekweter") --[[prints that iwt worked]]
end
end
end-----[[ends s]]
i liked and subscribed to your channel now thanks!!11
Also i think if you use OOP, make sure to over-complicate things and have 1000 classes (yes even for something as basic object that prob is only used once in a single level, make an entire class for it)
make sure to do else-if statements alot, and make sure to call intensive calls every frame, yes EVERY FRAME!
Now to Networking:
make sure to NOT secure any remote events, TRUST THE CLIENT!
Here is an example remote event:
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player, instance, property, value)
instance[property] = value
end)