I know the basics of scripting what do I do now?

I know the basics of scripting, but I’m unsure how to master it. I would appreciate recommendations on what to do next.

2 Likes

Here is a list of things you could try after learning the basics of scripting!

  • Learn other skills that could help you improve!
  • Learn the advanced sides of scripting like OOP (Object-Oriented Programming, Parallel LuaU, etc.)
  • Try making a fun little game.
  • Try getting commissions from people.
4 Likes

I have never heard of OOP before.

Well now you have. It’s kind of useless but at the same time useful.

Object Orientated Programming is used to make your own functions inside of your game.
Here is a thread on OOP. It isn’t really useless if your trying to make your own custom functions inside of your game.

Object Orientated Programming use ModuleScripts, which are also known for making up the movement of your character in Roblox. You can use ModuleScripts for any type of reason.

  1. To make a player move…
  2. To make an object float…
  3. To make a car accelerate…
  4. etc.

Creating a function inside of a ModuleScript is pretty simple. My favorite, when it comes to these, is making a MainFunction and something I call a “CalledFunction(s)”. The MainFunction is gonna be used to make the "CalledFunction(s)"inside of your game do what these functions need to do. The “CalledFunction(s)” don’t even need a MainFunction to do what its gonna do though.

Here is a example of a “CalledFunction(s)” getting called from the MainFunction

MainFunction

local module = {}
local mod = require(script:WaitForChild('ModuleScript'))

function module:printmessage()
	mod.print()
end

return module

CalledFunction

local module = {}

function module.print ()
	print('hey')
end

return module

Like I said, you can run a CalledFunction without a MainFunction
, it will still work the same. You can also store strings, or parameters inside of these functions (obviously).

MainFunction

local module = {}
local mod = require(script:WaitForChild('ModuleScript'))

function module:printmessage(n)
	mod.print(n)
end

return module

CalledFunction

local module = {}

function module.print (num)
	print(num)
end

return module

In order to run these, you can use either a Server or LocalScript. We’ll just use a Server Script in Workspace, and run these functions, like this:

local module = require(script:WaitForChild('MainFunction'))
local num = 5
module:printmessage(num)

The function called require is used to get the functions of certain ModuleScripts, so you can run them. If you don’t use the require function, then none of your custom functions will work.

Lastly, there is an extra parameter called self. Its a really simple and basic parameter, all it just refers to is the ModuleScript and its variables.

Make sure that self is always last when it comes to parameters.

ModuleScript

local module = {}

function module.print (str, self)
	self = module
	self.newmessage = 'hi'
	print(str)
	print(self.newmessage)
	return self
end

--[[

local module = {
ten = 10,
six = 6
}

function module.print (str, self)
	self = module
	self.newmessage = 'hi'
	print(str)
	print(self.newmessage)
    print(self.six)
    print(self.ten)
	return self
end

return module

]]

return module

They work as intended.
ra2
ra1
ra3
image_2024-06-30_104310077

Let me know if you have any questions, this is only part of what ModuleScripts can do.

1 Like

The only thing I know about ModuleScripts is that you can use functions in other scripts does it have any other functionalities?

Im pretty sure thats what its all about.

Here is a doc about ModuleScripts:

2 Likes

You should get into web development and learn other practical languages like HTML/CSS

1 Like

So pretty much just challenge yourself now, do stuff that you never did, enter in developer servers on dc, check people creations, get inspired and work, pretty much it

1 Like

you have a gun system, instead of updating code for each gun you create, just use a module to control and create guns

1 Like