have u ever wanted to make really cool ....................... or slop games.................... then this is the perfect tutorial for you
ok lets start with the basics
> print(string)
this prints out a value in the developer console in-game or in the studio output
> Instance.new(obj, par)
this creates a new instance
obj = the object class (i.e "Part")
par = the parent (i.e game.Workspace)
to manipulate the values of the instance, make it into a variable
here's an example
local instance = Instance.new("Part", game.Workspace) instance.BrickColor = BrickColor.new(1) -- this will make the part white
> if () then end
well, self explanatory, but it's different from most programming languages
- there isnt !==
instead, there is
if (par1 ~= par2) then print("par1 is not equal to par2") end
> okay, how do i detect if someone clicked on my part?
put a ClickDetector inside the part, and place a script either in the part, or in the ClickDetector
example:
- if you put the script into the ClickDetector:
script.Parent.MouseClick:connect(function() end)
or, if you want to keep it clean by using named functions:
function action() print("i was clicked!") end
script.Parent.MouseClick:connect(action)
- if you put it in the part
script.Parent.ClickDetector.MouseClick:connect(function() end)
function action() print("i was clicked!") end
script.Parent.ClickDetector.MouseClick:connect(action)
a common mistake people make when using putting functions is adding () you only need to pass the name
i will continue this later because i ran out of ideas
if any of these examples don't work please PM me and i will fix it :D