#In your programming journey, which part did u struggle the most?

1 messages · Page 1 of 1 (latest)

jade zenith
#

Anything

late stirrup
#

The beginning

fiery vessel
#

I had no idea where to start learning

tawdry charm
#

it was like a foreign language in the beginning

#

now it seems like something really simple which anyone can learn

#

Transitioning into the advanced and applying it in a project

pearl hornet
#

The beginning is the hardest step

pearl hornet
foggy vortex
#

The part where things are so complex that you do not know how to fix your code

sacred grove
#

Being organized and actually taking the time to get the system you just got working to actually be structured and implemented well

tawdry charm
#

def the start 💯

stable yarrow
#

Tables, I don’t know why I didn’t understand them, it was probably for loops and adding stuff to them

#

Everything else was quite easy

sacred grove
#

Cframes took a while since I was trying to learn them before I learned matrices in school

atomic cape
#

The part where your skill and knowledge plateaus

sacred grove
#

It does take a while to gain experience with 90% of the APIs and know enough to be able to just get started on projects and know how you should structure them

merry wraith
#

middle*, I kept overcomplicating things trying to use OOP everywhere I could, ended up restarting that project after a long break - keep things simple

#

beginning was difficult but once you've gotten a majority of the basics down it's gets a lot easier

tawdry charm
#

Take steps don’t flood yourself with info.

compact prairie
#

trying to fix a script that doesnt work without the output tab opened

gilded summit
#

every second

ripe merlin
#

anything with math because Idk trigonometry or geometry and alot of things like that.. (I want to learn it all from scratch but it's stressful and Im kinda procrastinating on it)

sacred grove
#

I learned all that through coding

timid nexus
late stirrup
timid nexus
#

Nah it's like having a picture book vs a harry potter style

sacred grove
#

I learned CFrames in like 7th grade

#

Yet I didn’t do matrices until the middle of high school

timid nexus
#

Same

#

I'd be pressed to find a reason to use matrices outside of programming

gilded summit
#

maths for nerds

sacred grove
#

You are a nerd

gilded summit
gilded summit
#

im just some loser bro

timid nexus
#

well you keep going around telling everyone you are one then you'll really be a loser

#

who cares if you haven't made money, roblox isn't exactly easy to profit on

#

you are doing something w your time

#

don't be hard on yourself

sacred grove
#

If you don’t want to do commissions and get rich try to make your dream game

timid nexus
#

Yea legit I only make games I'm burning to create

#

tbf I have tons of ideas I really need to get out of my head

#

but it's MORE FUN when I pick what I actually am the most interested in seeing

merry wraith
gilded summit
gilded summit
#

I'd rather do quick coms

gilded summit
#

I loose interest in 1 thing and think another is better and the overall quality and progress deteorates

ocean gull
#

Prolly staying on the same project

ripe merlin
#

I thought I was the only 1 that doesn't have much prior math knowledge but that's rlly nice to hear

#

Gives me hope.\

tawdry charm
#

but with most of the math stuffs u need its probably on google somewhere

jade zenith
#

math is the easiest subject

#

imo

#

if understand the formula, its gonna be easy

#

the hardest subject i think is english

ocean gull
#

Hard disagree, math harder.

#

English you can get away with alot more

jade zenith
#

math is just bunch of equations

#

and numbers

#

in english

timid nexus
#

Depends on the context

jade zenith
#

im trying to be fluent in english

#

i have 54 in english

#

while i have 87 in math

timid nexus
#

Polynomials harder than physics for me lol

jade zenith
#

hmm

#

how come?

#

i found it easy

#

i think we had it last year

#

classic physics is easy honestly,

timid nexus
#

I just really hate the amount of rules that go into algebra

jade zenith
#

true

#

so many equations

#

pretty underwhelming

ocean gull
#

For example bullshitting answers way easier in english

#

And english i like the flexibility
But i was better at english in highschool so i got a bias😅

pearl hornet
#

just make sure the teacher isn't asking impossible question in your eye

#

s

tawdry charm
tawdry charm
#

that was so me

#

xd

jade zenith
wild lance
#

Data stores are still so irritating to make.

#

Physics.

tawdry charm
#

not really

#

just use profileservice or suphi's datastore if its a issue

timid nexus
#

True data store has some pretty annoying edge cases to consider, to use a pre-made service that covers the bases for you is a blessing

#

i think it's just frustrating cuz mitigating save data is extra work 🗿

radiant lotus
timid nexus
#

Like syncing the data store to the game state

jade zenith
#

sigh

#

its hard being stupid

timid nexus
#

Basically I'm just saying: the loading of saved data

merry wraith
pearl hornet
#

at first ur interested, must turn back rn.

#

at second u regret, last chance to turn back rn before u consume even more.

#

at thirds u change your mind because of drug effect, it's not easy to turn back rn.

pearl hornet
pearl hornet
timid nexus
#

your unc was having a schizo episode cuz he can't handle his substances 💀

#

dude should lay off the shrooms

pearl hornet
#

💀

verbal nexus
#

I have been trying to make a real game but I still end up making obscure games which doesn't have any point

#

And of course mathematics

jade zenith
timid nexus
#

Tru

verbal nexus
#

👍

static scaffold
#

For me is learning new things, always when i make a project i put months into it and have really specific things that i cant find a tutorial or any forum and i dont know how to start with those specific things.

jade zenith
tawdry charm
#

google is nice

#

i find suphi kaner videos cuz google

tawdry charm
#

Facts

#

For me it's OOP I don't know why but I can understand it in some cases but then I try to implement into something I am doing and die

tawdry charm
#

oop eze.

jade zenith
#

I learned oop in class

zinc scroll
sudden glen
#

radians quaternions

sudden glen
#

dam

timid nexus
# sudden glen dam

yea I'm not gonna pretend to have read it but my friend told me conceptually rotors are easier to understand than quaternions

ocean gull
#

Learning how to ask questions for coding is a major skill. When i started off this was hard

#

Also getting stuck in tutorial hell

#

When you realize all languages are tools and basically the same, you will reach enlightenmrnt

sacred grove
#

Debugging

#

It’s pretty simple but not something you learn except through experience

#

The goal: find the line that isn’t working

jade zenith
#

I think the hardest is ray tracing

#

like programming raytracing

#

and putting properties to it

fiery vessel
#

So u coded raytracing?

sacred grove
#

Ray casting is pretty simple

#

Did you code your own ray tracing and lighting module or something?

digital solar
#

game architecture and finding the best programming practices

jade zenith
#

i just thout it might be the hardest part to program

compact prairie
turbid breach
#

Trigonometry and physics(math)

sacred grove
#

I found programming to be a great intro

#

I learned those topics long before school

#

So I did very well in math

summer nexus
#

myself ._.

zinc scroll
#

e

jade zenith
#

Wew

#

were finally learning abt trigs

sacred grove
#

Are you in geometry?

jade zenith
#

pre cal class

#

i just realized that i also need to take applied math

#

sighh

tawdry charm
#

applying trig into programming is hard

#

i've learned trig from school but i can't apply it

sacred grove
#

I only use it in 2D

#

The first time I used it was for a 2D fishing game

#

it is a side view of the fish swimming around and your character up on the dock

#

when you click, your fishing line has a length

#

so let's say you clicked 500 pixels away and your length is 250

#

well we can use Pythagoreans theorum to get the length and compare it

#

but to get the distance, we use tan

#

the x is the opposite and the y is the adjacent

#

the hypotenuse is the distance

#

we get the angle at which you clicked

#

then we do more trig with the angle and max distance to find the x and y

tawdry charm
#

would this be considered as raytracing?

#

all i did is just cast rays (raycasting using roblox's raycast)

tawdry charm
#

2d trig isn't that bad

#

but when it comes to projections/making stuff rotate/camera manipulation then i get lost

jade zenith
#

idk

#

i havent checkt it

tawdry charm
#

so it's not actually raytracing/raycasting, but a clone of you/your surroundings is being displaying inside a viewportframe

jade zenith
#

so im not sure what to say

#

:_<

tawdry charm
#

viewportframe is uhh u put a camera in it

#

and then u put a part

#

and it shows the part

#

it's like if u want 3d inside gui

jade zenith
#

like illusion tbh

tawdry charm
#

yea

jade zenith
#

whats diff abt raytracing is the surfacing and textures

ionic aurora
#

I dunno, can't say anything when it's really fun to code.

clever gyro
#

finding the magic numbers sometimes odd one works....

jade zenith
tawdry charm
#

metatables 🙃 a blessing and a curse to learn

verbal nexus
#

Metatables concept will become easier after you learnt it

sturdy igloo
#

Anything physics related. Never was intuitive to me, never will be.

obsidian steppe
#

return

jade zenith
#

OL

#

They say it just exit the code block

obsidian steppe
obsidian steppe
jade zenith
#

Literally formula is already there

obsidian steppe
#

Metatables are also hard to learn. In fact i havent learned it yet

jade zenith
#

Whats hard is pure math

jade zenith
#

I always thought of metatables as oop

#

Like

#

Having a parent and chils

#

That can access stuff

#

Inside the parent

ocean gull
#

Lag compensation to me is by far the hardest thing to code.

jade zenith
#

but optimizing them is diff

#

that as wel

lyric mantle
#

math (I'm still struggling)

lyric mantle
lyric mantle
#

is same as physicals?

pearl hornet
#

part of the science career

#

biology too

#

chemistry too

#

they are not easy subject. sometimes you have to know some of the physic formula just to get your thing working.

fiery vessel
#

If someone is too lazy too Google it

lyric mantle
tawdry charm
#

i struggled trying to make a car but thanks to suphi kaner

#

now im struggling to make a grab tool

deep hearth
#

I hate pathfinding with a passion

jade zenith
solar nacelle
#

mostly the same here

solid gorge
#

Im at the point in projects where I can individually create systems and features but trying to tie them together in a robust and organised way is just... not possible with my current understanding of software architecture.

tawdry charm
#

well alright

#

im a intermediate

tame pewter
#

Math and errors created by myself (no output message)

blazing inlet
#

the beginning and understanding the math (im only gr 8 lol)

oak crane
# jade zenith Anything

Finishing projects / games. Before during 2018-2022 I had only ever finished 1 or 2 games, got so worked up on how I should be doing things and what the best way to do them was. Ended up going from Knit, to making my own BIG Games style Framework, using Roact and Rodux to eventually settling down with Roblox Typescript + Flamework. That part was the worst and best part about learning, because I could actually find what was best for me whilst learning all those other things

#

However it pisses me off a lot when I remake a lot of projects because I always find better ways to do things

#

Now that isn't so much of a problem 😅

jade zenith
#

Well

#

Thats a milestone right tgere

#

There

#

Hopefully ill be successful as u are

solid gorge
# oak crane Finishing projects / games. Before during 2018-2022 I had only ever finished 1 o...

I find the issue with "finishing" project for most part is the scope, I've been working with a friend and he has all these ideas that would make for a fun game but the scope is so big that it's difficult to achieve without putting hours into development. I think after a week of development and we've only just started finishing up the basic framework (In our own free time - I have work, he has university) he's now understanding just how much work will need to go into making his ideas a playable "product". Unfortunately I think his interest and motivation towards the project is waning, where it'll end up with myself being a solo developer to at least try to finish the project, Because I find it quite fun to work on.

As someone that's gone through that many times before with unfinished project after unfinished project to newer developers, take a little advice from myself and more than likely other developers. Keep your scope small and build on it afterwards, There are SO many people that jump into projects to just start attempting to make the next big MMORPG etc etc etc. Which is fine I suppose, you have to learn somehow but at least take something away from it besides, "This is too much" or "This is too hard".

this isnt directed at you btw, just a good topic to talk about Smirkge

oak crane
#

Yeah, started on focussing more on "cash-grabs" to pass the time, but I'm trying to make them better quality rather than some groups (cough lol games cough)

#

All power to them though, getting that bag 💰

oak crane
#

At the minute I'm making games in under 3-4 days now, with the kit I've made

#

So hopefully development speeds up a bit

jade zenith
#

I mean

#

I cant even publisg one

oak crane
#

Tbh right now, games don't even need to have quality

#

just make quick games and spend some robux

#

get KPIs up n players should come organically

jade zenith
#

Ye true

#

I cant with those sims games that js grabs mone6

#

And never update it again

oak crane
#

Just gotta keep working

#

throw enough at the wall and one will stick

#

keep tellin myself that everyday 🤣

quaint grail
#

math

lyric mantle
quaint grail
#

here's some resources:
Learn OpenGL book : https://learnopengl.com/Getting-started/Transformations
Youtube Channel for math : https://www.youtube.com/@3blue1brown

quaint grail
sweet bolt
#

making the switch from procedural to object oriented programming

#

procedural always made sense

jade zenith
deep hearth
#

i find it to be unnecessary

solid gorge
#

If anyone wanted to learn it, I'd very heavily recommend learning it in Java or C# first

deep hearth
solid gorge
# deep hearth i wouldn't use oop anywhere

Well the whole issue behind the paradigm in my opinion is knowing when and when not to use it. Even more so when to do it correctly, It's incredibly easy to use OOP in the wrong way and cause more issues than it's worth.

I find trying to distinguish what should and shouldn't be Abstracted to be the most difficult thing about OOP, so once you get past that stage the rest sort falls into place.

solid gorge
#

Like it's super easy to fall into diamond inheritance

deep hearth
#

Thanks for the Explanation though

solid gorge
deep hearth
solid gorge
#

I think there are legitimate criticisms behind why OOP shouldn't be used and for the most part they're somewhat true

deep hearth
#

So procedural coding is what i stick with

solid gorge
#

I'd prefer ECS too but it's not required when the Objects don't need to have so many different parameters

deep hearth
solid gorge
#

Personally, I think (Probably wrong) the whole reason behind using the paradigms is to ensure you're not repeating code in multiple instances

deep hearth
#

Entity system faction war thingy

solid gorge
#

If I were to start again, I'd probably learn both ECS and OOP at the same time to better understand how they defer from each other and where to use both

#

I struggle to get out of the habit of using OOP even though ECS is, imo a much better paradigm. I just have the issue of writing inefficient code when I use ECS shrug

jade zenith
#

I think oop is great cuz its abstract

ocean gull
#

I learnt java / c++ before lua so oop was natural to work with

#

Although oop in lua is ward

#

weird*

jade zenith
#

Lua isnt oop

ocean gull
#

Ik

solid gorge
pearl hornet
#

sometimes people know the answer to your programming problem but lazy to reply

oak arch
#

sometimes people act like they read your help post, but in reality are only capable of reading 5 words before needing to say something about it

remote panther
#

E

tawdry charm
#

fr

zinc scroll
#

fr

jade zenith
#

Fr

zenith jetty
#

fr

remote panther
#

||fr||

summer nexus
#

| fo r eal |

lyric mantle
#

Fr

lyric mantle
#

fr

tawdry charm
#

4 real

blazing inlet
#

fr

lyric mantle
#

⁴ r

zinc scroll
#

4real * 0

gaunt umbra
#

fr

pearl hornet
#

from watching random YouTubers -> HowToRoblox -> GnomeCode -> Suphi

oak arch
#

In my programming journey, the hardest part of it was me

#

👿

#

😈

lethal cradle
#

thats for me pretty much

tawdry charm
#

how do i make sure to concat the reason and get the spaces in

#

wait i did it

turbid breach
#

math

open lichen
#

applying concepts i learn for optimization is one of them

lyric mantle
#

Moon animator

#

#1192343297017008170

brave seal
#

it was really easy since i knew another similar language to lua before i started lua so it wasn't that hard to learn the syntax , the hardest part for me was animation unrelated to programming

fallow pier
#

Having no time was the hardest one all along

deep hearth
#

maybe the hardest part were the friends we made along the way

jade zenith
sleek field
#

sorting and data handling

#

currently I want to use ProfileService to do a project with tables(eg: Thing1 = {Value = 2, Name = "Whatever"}, Thing2 = ... ) And I want to sort the datastore by the highest value to the lowest. I can't just fetch the whole data store and sort it because it might be very long, and I need it to refresh so repeat the operation multiple times

desert scarab
#

Trying to make a combat system with vfx(I still struggle to make slash vfx)

desert scarab
#

I just can't do something like this ):

desert scarab
#

Me

gilded summit
#

and then just tween it

desert scarab
#

Both don't work

#

I tried

#

Beam is not timed well

#

And trail is depending on an animation, but the animation suck

hardy arrow
#

no idea why but i couldnt understand for loops for like a year, I used to make custom for loops with while loops if I ever needed to loop thru something (started with 0 programming experience)

blazing inlet
#

💀

sleek field
lavish flare
#

i started programming on scratch and then i moved to unity then roblox

#

thats game development

#

but i also did web development and other things for some time after scratch

lyric mantle
pearl hornet
#

not resetting environment (not related to roblox studio)

pearl hornet
rain roost
#

Currently struggling with where I should organize my scripting and functionality

tidal bluff
#

oop

#

took me 6 months to comprehend

desert scarab
deep hearth
radiant coral
#

quaternion (still learning)

barren knot
#

don’t know what to do

dense wind
#

Idk, probably cframe

hardy arrow
#

i personally used tutorials to make myself excuses to not do stuff

blazing inlet
#

lol

#

i also got stuck at tutorials as well

worthy lava
#

metatables are a problem

barren knot
blazing inlet
# barren knot how'd u break free

as i kept watching the tutorials, i sort of understood how to make my own things, personally, the fasest way to break free is to use the roblox documentation and how to script guides on youtube instead of (how to make shift to sprint, how to make doors in roblox etc.)

#

plus yt tutorials dont really help with debugging

jade zenith
#

Especially when someone who skip parts(totally not me)

barren knot
#

but when i get to trying to script like lets say a sprint system

#

i have no idea what to really put

#

i guess documentation would fix that though

#

and yeah i have a really bad just copy and follow along problem

blazing inlet
#

same

hardy arrow
barren knot
hardy arrow
#

break the task down into steps
something like this

  1. listen for input
  2. check if the input is valid
  3. change the player's walkspeed
#

usually a common thing that people say to others who are starting out

#

helps with most stuff

#

if you are making something big then you can break down the steps into more steps

#

1st step

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function()

end)

2nd step

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input, gPE)
  if gPE or input.KeyCode ~= Enum.KeyCode.LeftShift then return end
end)

3rd step

local UIS = game:GetService("UserInputService")
local plr = game:GetService("Players").LocalPlayer

UIS.InputBegan:Connect(function(input, gPE)
  if gPE or input.KeyCode ~= Enum.KeyCode.LeftShift then return end

  plr.Character.Humanoid.WalkSpeed = if plr.Character.Humanoid.WalkSpeed == 16 then 32 else 16
end)
#

toggleable one

#

probably should use contextActionService

umbral bison
#

100% the beginning just whenever u see something red having no Idea why and how to fix it and so many bad tutorial

umbral bison
tawdry charm
tawdry charm
umbral bison
tawdry charm
#

i shall proceed with your execution right this moment

umbral bison
tawdry charm
#

are there any last words you'd like to mention before i proceed?

ripe jetty
#

wrangling studio and following tutorials for hours to just to implement a system message or somthing like that but nothing you try seems to work for some stupid reaso

umbral bison
#

the coding is soemthing diffrent

#

I mean they have blueprint which are pretty nice and stuff and tell you exactly what they do but there are like over 3000 blueprints and if you search something and cant find it its so frustrating

#

also bc unreal doesnt have as many beginner tutorials as roblox studio

supple frost
#

imo just learn the basics from tutorials

#

like syntax etc

#

and learn the rest as you go along with doing stuff you want to make

#

not what some guy in a tutorial is making

#

that's what makes me motivated

#

anyway

wide path
#

The end

lime patio
lime patio
split mason
#

learn all the basic and intermediate knowledge

#

and then go make stuff

lavish flare
mint ibex
#

I never struggled much with the material, my struggle was finding the motivation to continue and trusting that I could become better in due time. Programming isn’t easily picked up, it just requires daily practice to learn. Id say the struggle to ignore imposter syndrome and try to find something new to learn every day, persistently.

It becomes more noticeable on why that is important the further you get into more complicated topics.

Although if I am being technical, the best thing that helped me was having a strong foundation. Know all the basics like data types, variables, functions, callbacks, events, connections, loops, OOP, functional programming & recursion, and especially your bare bones like built in methods, if then logic, keywords, and type conversion.

Then learn services like tweens, and spacial query, remote events and remote functions, user inputs, camera manipulation, and how to make ui functional.

Then learn client server networking strategies, linear algebra with vectors, and start making plugins and resources to challenge your proficiency.

Once you’ve mastered these you’re already thinking like a programmer and can pick up new information very quickly.

There’s a lot to cover, and new things are added every month. Persistence will be most beneficial because it does get easier as you practice and eventually becomes fun.

warm tapir
#

every bit

timid pecan
mint ibex
timid pecan
tidal bluff
umbral bison
timid pecan
#

only that I'm kinda good

#
  • I don't have high expectation of myself
#

Mostly because I know what I can

#

and can't

umbral bison
#

so u wont have imposter syndrom?

#

or do u?

deep hearth
#

many factors

timid pecan
deep hearth
timid pecan
#

?

tawdry charm
#

It took me 1 year to learn for loops

#

then I learned things easily

#

its because how young I was

#

I started learning like when I was 9 - 10

timid pecan
hardy arrow
#

Nah same

#

Used while loops to replace them

visual umbra
#

i gotb ored xd

timid pecan
flint geode
#

I struggled with overthinking the most

orchid coral
#

You want to make something, but you need to get this other thing done that you dont really know how to do, and then you get distracted and you try upgrade something else, but you dont really understand how to upgrade it

#

And then irl stuff comes and you dont have as much time and the time you do have you want to play Scorched Earth or pf

hardy arrow
#
while true do end
for i = 1, math.huge do end
repeat until false
winged hound
#

Following through with projects, still struggle with that D:

timid pecan
#

wth is that

#

a

#

.

#

true

hardy arrow
#

Not practical but it's possible

#

You can also loop with functions and modules

orchid coral
#

getting a clean simple system together when there so much to improve and gui. I still dont know how to make a simple menu main ui that isnt 500 lines long thats easily readable. also USING that system is pretty tough, and then you got school and life and not wanting to be in a chair for hours at a time that stops you.

surreal crown
#

constraitnsssss

#

i need to learn constraints theyre really powerful

#

i juts cant bring myself to do so

#

i make functions that replicate to the client for elevators instead of using prismatic constraints

eternal igloo
#

it was learning how to read documentation because i was so young

#

there werent that many good sources back then so your best bet was just reading its doc

sleek field
#

But then it helps you on all of your game gui cause you can make for example a button component that you can re-use everywhere so you will have consistent UI

#

And you can separate a lot of logic through different files which makes your code more modular and easier to add features and fix bugs

orchid coral
tired raft
#

Understanding vector3/angles. Still havent grasped CFrame all too well.

hardy arrow
#

the most basic definition imo

#

also has some extra stuff like lookVectors and what not but you rarely use them

#

some people love to over explain what a cframe is by including the 3x3 rotation matrix and stuff like that

tired raft
hardy arrow
#

use it whenever you are moving or rotating something

#

functions like lookAt are self explanatory

#

the more complex functions have good documentation

frigid brook
#

the very advanced starting one while beggining you may be get a lot of struggle but in advanced one for first time you feel like your brain will gonna blow

barren knot
eternal igloo
barren knot
#

i can read its just sometimes its confusing

#

i guess

timid pecan
#

fr\

summer nexus
#

Patterns and Concepts

neon viper
#

Nothing, im just different

summer nexus
#

show progress then 💀

tawdry charm
#

buying a pc

vernal coyote
#

organization and code structure

pearl hornet
#

Analyzing other people's code can be very annoying especially if their program is very messy and disorganized

#

Learning code block is more tedious than typing the code.

thin yoke
#

🔥

#

Its whatever caude dev benefits

cloud sigil
#

perfectionisme

#

and understooding what for loop does

supple frost
#

what’s code block? like scratch?

vernal coyote
#

framework and code structure

solid raptor
#

It's always unclear how to structure your framework

uncut jacinth
#

hard work

#

to actually finish a game of decent quality in a reasonable period of time you have to 10hours a day everyday

#

also estimating timeframes

#

is extremely hard

#

even 20+ year experience software engineers find it hard to estimate timeframes

tawdry charm
#

The hardest part for me, unlike many others wasn’t the beginning - it was the period where I’d have watched every tutorial on youtube, had decent knowledge of the language but just couldn’t figure out how to keep learning & improving, I felt stuck.

Then I realized all you need to do is to experiment, code anything you can imagine, try to recreate games you like - this way I started running into new issues, discovering new ways to do things & kept improving

uncut jacinth
#

learning to actuallly make things

#

is just about trying to make them

#

thats not hard part

#

u just need to know the right resources to look at

#

like devforum

#

roblox api

#

n stuff

#

hardest part about scripting is 100% finishing a game

tawdry charm
#

Creating anything that takes time can be difficult to stick to

#

For instance, I was planning to build a chair once that I never managed to finish

autumn wyvern
#

Finishing a project

thin yoke
#

fr

acoustic storm
#

Metatables in Roblox Luau. Idk why, but I have difficulty grasping the concept and using it when coding. To be fair, I haven't really tried to learn it. I've read about it in the Roblox Studio documentations and watched a couple videos, but nothing really else.

lunar rover
#

It basically just adds methods to a table

acoustic storm
#

Well yeah I get that. But like, when it comes to using "self" and like __index in module scripts, I get lost

hardy arrow
# acoustic storm Well yeah I get that. But like, when it comes to using "self" and like __index i...
local character = {}
character.__index = character -- __index can be set to a table that will be searched thru if you try to access a value that doesnt exist (including functions!)

function character.new(name, health)
  return setmetatable({
    Name = name,
    Health = health or 100
}, character)
end

--[[
function char.GetHealth(self) -- works the same as the method below
  return self.Health
end
]]

function character:GetHealth() -- : adds self automatically
  return self.Health
end

local newChar = character.new("Test", 100)

print(newChar:GetHealth()) -- newChar would be self
#

__index is a tricky one to explain

#

better to understand it by experimenting imo

#
local defaultValues = {Name = "John", Age = 21}
defaultValues.__index = defaultValues

local newGuy = {Age = 99}
setmetatable(newGuy, defaultValues)

print(newGuy.Name) -- Name doesnt exist in newGuy, seeing if metatable has the __index metamethod and searching thru that instead if so
-- prints John
#

not sure how good this example is

#

might help you get that "click" in your brain

acoustic storm
#

Oh I think I get it. So it's more for like "just in case" situations?

hardy arrow
#

but could be used like this yeah

acoustic storm
#

Oh ok

hardy arrow
#

you can also set it to a function

local defaultValues = {Name = "John", Age = 21}
defaultValues.__index = function(t, v)
  print(t) -- prints the newGuy table
  print(v) -- prints "thing"
end

local newGuy = {Age = 99}
setmetatable(newGuy, defaultValues) -- Name doesnt exist in newGuy, seeing if metatable has the __index metamethod and searching thru that instead if so (or if its a function then call the function)
print(newGuy.thing) -- nil
acoustic storm
#

If I wanted to make a whole attachment system for a gun game. Where I can customize my gun by adding attachments and stuff. Would this be useful? How would I implement it

hardy arrow
#

id just use metatables to use OOP and make classes/objects for attachments/guns

#

not sure how familiar you are with OOP

#

definitely would recommend it though

#

allows for clean code

acoustic storm
#

Yeah I'm familiar with IOP

#

Oop

#

I see

noble gazelle
#

Are you like trying to make a factory attachments or what. Oops seems redundant in this case imo

dense tangle
#

params and arguments

autumn wyvern
#

But basically it is the first parameter sent to the method, which specifies which object the method is being used on.

#

You can just grab the parameter yourself instead of defining the function with :

#

Just define it as a normal function like so:

local function myMethod(object)

end
acoustic storm
uncut jacinth
#

u just need to learn what they do

#

np bro

acoustic storm
#

Lmao

chrome spade
#

Motivation

winged hound
noble gazelle
#

Gotta give him A for effort

hardy arrow
#

but everyone learns differently ofc

river summit