#Lua OOP

1 messages · Page 1 of 1 (latest)

severe girder
#

Do you guys recommed usong a OOP style coding or just single script with use of modules coding?

#

Tag me for any guidance

drowsy mist
#

depends

severe girder
#

I meant for a well structured game, OOP is something i would always recommend

#

But idk for Lua

eager arrow
#

i use OOP everywhere, but it depends like he said

upbeat snowBOT
#

studio** You are now Level 2! **studio

dreamy patrol
#

well dont use it if you dont need to

#

cop is good for bigger games

severe girder
#

I get it for the depends but for overall use it is recommeded.

#

For playerdata saving it would also be recommended

#

I would guess

eager arrow
#

i use OOP only for system, like combat system, or other system, but if it for dataStore i use community lib, like ProfileStore (it's just a exemple)

severe girder
#

i see i should start to look more into lib's always was using my own

#

Creating my own storage system

limber socket
limber socket
#

you can use zoneplus if you dont want to write a spatial query

severe girder
#

Do you also have a good site or somewhere i can buy vector icons?

eager arrow
severe girder
#

I found a site but they require a licence after buying it, found it a bit scummy

eager arrow
#

ah my bad

severe girder
#

No like the icons for rebirths etc

#

Money, Gems, Shop, ..

eager arrow
#

there are free pack for icon like this, like icon for simulator

severe girder
eager arrow
severe girder
#

Thats why i tried to find some paid ones, might offer some variety

eager arrow
#

sorry i can't help you on that, i don't know many market website

severe girder
#

That was so confusing for me

#

That it has multiple entry points instead of the normal 1

eager arrow
#

one moduleScript is for one thing about a system, and you need a loader because with all the module that was create for one thing will be regrouped in the loader to create the main behavior

#

did you get it? i mean did you understand what i said?

severe girder
#

Yeah i got what you mean, but i mean that in Java you have to call the data to 1 entry point whilst in studio you can call you data anywhere in any script

eager arrow
#

because moduleScript was made to be shared everywhere, like for global variable or global table

severe girder
#

i meant hat you dont need a

public static void main(String[] args)
{

}
severe girder
eager arrow
#

but now you know how to use it right or you are still a bit confused?

severe girder
#

Nooo i was never confused it was just weird in the first day or two

#

This is my first week scripting but i have experience in C, C#, Java, ...

#

I was only confused about the OOP part if it was used

eager arrow
#

lua is very easy to learn since is the easiest language x)

#

if you know C++, it'll be very easy for you

severe girder
#

i find lua very lazy

#

hahah

#

It was only weird because i am used to singleplayer coding, now i have to combine the server & client part and beaware that hackers can access certain parts

eager arrow
#

if you want a typecheck like C++

just put this in the first line of your script
--!strict
it will check every type of everything

upbeat snowBOT
#

studio** You are now Level 3! **studio

eager arrow
#

only give the neccesry to the client

severe girder
#

Yes, do you also spam remote events? or are there better ways to connect server-client

upbeat snowBOT
#

studio** You are now Level 2! **studio

severe girder
#

Like how i update my gui with server-client i spam remoteevents

#
function PlayerStatsManager.SetMoney(player, amount)
    local stats = PlayerStatsManager.GetPlayer(player)
    if not stats then return end
    stats.Money = amount
    UpdateMoneyEvent:FireClient(player, amount)
end

function PlayerStatsManager.SetRebirths(player, amount)
    local stats = PlayerStatsManager.GetPlayer(player)
    if not stats then return end
    stats.Rebirths = amount
    UpdateRebirthsEvent:FireClient(player, amount)
end

function PlayerStatsManager.SetHighscore(player, amount)
    local stats = PlayerStatsManager.GetPlayer(player)
    if not stats then return end
    stats.Highscore = amount
    UpdateHighscoreEvent:FireClient(player, amount)
end

Like litteraly i spammed it here.

eager arrow
#

remoteEvents is the main target for hacker so be sure to add sanity check

severe girder
#

So it isnt really onorthodox how i did it here

#

Because they are in the replicated storage?

#

sometime i encrpyt the data before

Damn that is actually insane hahah

#

I never protected my remote events before i will make sure to do that

eager arrow
#

ReplicatedStorage is for client and server but serverStorage is for server only (that why you can't get object in serverStorage from localscript)

#

sorry my wifi got disconnected x)

eager arrow
#

if you don't protect it

severe girder
#

So i understood there is no-way that a hacker can acces anything server-side, only client-side so ill have to protect everythat that touches client side

warm cloak
#

Btw if you do PlayerStatsManager:SetHighscore you could use self:GetPlayer()

eager arrow
severe girder
eager arrow
plain valve
severe girder
#

and making my own first before using a lib

#

that will make me understand more what the lib will do

eager arrow
#

(it's just a exemple)

#

but ALWAYS add sanity check on your server-side script

plain valve
#

not sure abt that

#

that the problem

#

when the client send me his position

#

and I verify the position of the client ON the server, well there is latency, because client movement are being replicated to the server, id say a huge latency

#

so the player position on server is not the same as client

eager arrow
#

that was just a exemple, i'll do it with a another exemple wait

plain valve
eager arrow
#

function text.new(player)

  local self = setmetatable({}, test)

  self.Owner = player

  RemoteEvent.OnServerEvent:Connect(function(Player))
    if self.Owner ~= Player then return end -- Sanity Check
    ...
  end

  return self

end
eager arrow
plain valve
#

but so in the case you need the client position

#

how do you do

#

like his hrp position for example

eager arrow
#

always get the position from server-side, if it's something critical

#

or make your system to be use only by the server

severe girder
#

I see so that the client can onl be used " Want that information"

eager arrow
#

the only thing i really don't know how to check is the Camera Position, you can't tell if the position of the camera you send with the remoteEvent is a real position, because on server-side you can't get the camera position, so my idea is to check if the position i got is not too far from the player character

plain valve
plain valve
eager arrow
severe girder
#

i mean exploiters will always find a way

#

to exploit

eager arrow
eager arrow
#

idk if it's the right name

plain valve
eager arrow
severe girder
#

Idk how hacking/exploiting works in roblox, i am fairly new to roblox coding. Why do you need a player's position? Might sound a dumb question, but don't the exploiter have a kind of GUI (never saw an exploiter lol)

#

so very new information

eager arrow
eager arrow
eager arrow
#

exploiter have only acces to client, but they can find backdoor using remoteEvent

plain valve
plain valve
#

exploiters can load their local scripts faster then the game local scripts?

eager arrow
eager arrow
severe girder
eager arrow
#

or any kernel function to get acces to the memory

severe girder
#

its kind of facinating how deep exploiters will go for some gems and money

upbeat snowBOT
#

studio** You are now Level 4! **studio

severe girder
#

😂

#

On minecraft my first project was a ip grabber 😂

eager arrow
plain valve
eager arrow
#

but on some game is literaly too easy

#

just use a kernel function and the game won't even detect x)

#

CSGO don't even try to make a anti-cheat lol

severe girder
#

like it is so stupid, you download it from someone that creates them

eager arrow
severe girder
#

too bad i dont have a camera 😂

plain valve
#

atleast ig

#

but ye you right

#

most exploits prob kills your pc lol

severe girder
#

I mean more advanced exploiters will make u botnet slave

upbeat snowBOT
#

studio** You are now Level 3! **studio

severe girder
#

Instad of a trojan

#

or a miner

eager arrow
#

botnet is not that easy lol

severe girder
#

Yes, but i think that would be one of the better ways to use another one's computer.

#

DDossing can still cause mayor damage

eager arrow
#

i need help for my portfolio, what can i add? (it's snow particule in the background)

#

(Pufferfish is my main account)

severe girder
#

Tbh there is a reason why i am searching for vector icon's and GUI idea's 😂

severe girder
#

hmm

#

i mean

#

might be a bit of a stretch, but you could make the stars interactivee

#

for example if you move to the right the backgrounds shifts slightly ass well

plain valve
eager arrow
eager arrow
severe girder
#

Not every indevidual star, that would be too much

#

but i think you can still make it nice if you integrate a black background and stars on top

#

and make it shift in a group

#

like with an animation style it could make it smooth

eager arrow
#

bro english is so hard, i try to understand what you are saying lol

severe girder
#

wait nevermind that idea i gave you

#

thats good enough

#

i thought it was a fixed bg

eager arrow
#

actually the current version is looking like this

#

it's so empty and i put some bad system 🙁

#

(is a model 3D and not a gif/video)

severe girder
#

i mean the idea isn't bad but its indeed just empty

eager arrow
#

so that why i'm working on a V2

severe girder
#

most people that i know have an empty site because they are very bad in frontend

#

maybe use figma and just see what yo ucan do

eager arrow
#

frontend is not my speciality lol

severe girder
#

instead of trying to invent, just try it there

eager arrow
severe girder
#

When i was creating my own website i also did it in figma

#

Yeah it is also good for frontend

#

like really good

#

it also gives the correct dimentions and if it is absolute etc

eager arrow
#

recently i lost my USB, inside that USB there we're all my script, C++, lua, python, etc... i lost everything 😭

severe girder
#

Exactly why i will never use a USB

#

I use a drive and in a couple of months i will use a Server

eager arrow
#

but my pc storage is limited to 50gb, window take too much 😭

severe girder
#

i will use my old computer insert proxmox (for VM), and use teamviewer

#

for remote acces

#

instead of downloading some sketchy or paid version for remote

severe girder
#

or have downloaded too much

eager arrow
#

my pc still freeze on opera GX

severe girder
#

Btw if you space out your website like this it would feel less empty

#

imagine if the text were images

eager arrow
#

yeah, on the V2 i'll put the text on the center

severe girder
#

Like you have the Title on top, maybe a nice looking icon like you have right now and having a info tab under it

#

Or what you also can do is make it so that the whole square (ex: Mini Map 3D) covers the width of the container and when you hover there comes up and info bar under it with the informatio nyou have

eager arrow
#

you mean, you want my website to be responsiveness?

upbeat snowBOT
#

studio** You are now Level 5! **studio

severe girder
#

your website has te be responsive

#

In the responsive that a even a phone can look at it

severe girder
eager arrow
#

reponsiveness is so hard, i'm still learning

severe girder
#

Alright

eager arrow
#

AYOO i finaly got the level to put message in for-fire channel

severe girder
#
@media screen and (min-width: 769px) {
    /* STYLES HERE */
}

@media screen and (min-device-width: 481px) and (max-device-width: 768px) { 
    /* STYLES HERE */
}

@media only screen and (max-device-width: 480px) {
    /* STYLES HERE */
}```

Example this is basic responsiveness. When you your device hits a certain width it connects to that query
#

If you do not have any css in that query nothing of css will show up

#

BUT with what i mean you dont need responsiveness added. If you make your box container max-width it will automaticly be responsive

#

to any device

eager arrow
#

all the logo i made for each system i made

severe girder
#

I would refrain from using width: ..px, in the long run you would run into responsive ness issues because your width size never updates

upbeat snowBOT
#

studio** You are now Level 4! **studio

severe girder
#

What i said shouldn't be much of a challange. Just make sure you use containers to put your html in

severe girder
#

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Two-Column Layout</title>
    <style>
        body {
            margin: 0;
            font-family: Arial, sans-serif;
            display: flex;
            height: 100vh;
        }

        #Leftside-container {
            width: 250px;
            background-color: #2c3e50;
            color: white;
            padding: 20px;
            box-sizing: border-box;
        }

        #middlescreen-container {
            flex: 1; 
            background-color: #ecf0f1;
            padding: 20px;
            box-sizing: border-box;
        }

        h2 {
            margin-top: 0;
        }
    </style>
</head>
<body>
    <div id="Leftside-container">
        <h2>Left Side</h2>
        <p>Navigation or sidebar content goes here.</p>
    </div>

    <div id="middlescreen-container">
        <h2>Middle Screen</h2>
        <p>Main content goes here.</p>
    </div>
</body>
</html>

Example here is that you create containers and 1 container has indeed a width. But container "middlescreen-container" has flex 1 which means that he will take the remaining space. For to make it responsive you will juse have to update the html<div id="Leftside-container"> pixel width.

eager arrow
#

ohh okay, i understand now

severe girder
#

You can add a box

.box {
            background-color: white;
            padding: 20px;
            flex: 1 1 200px; 
            box-sizing: border-box;
            border-radius: 8px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }```

where the flex would show width grows, minimum 200px 

i know i am over explaining a bit
eager arrow
#

what is only screen ?

severe girder
#

that it targers moniters, phones, tables everything with a screen

eager arrow
#

oh okay

severe girder
#

You can all so use " @media all { ... } -> hits up all devices", "@media print { ... } -> only when a page is in print view"

#

but i never used those

#

i only have used screen

eager arrow
#

since i'm suing tailwindCSS, i just have to do ?


@media screen and ... {
  -- width: ...
  -- height: ...
}
severe girder
#

Btw Flex-box is a super nice way to learn to css

https://www.w3schools.com/css/css3_flexbox.asp

Use this to learn flex. It is prob the most easiest way to make things automaticly response

#

I am not a Front-end expert but i have made some sites for school

severe girder
severe girder
#

You can also use Grid boxes

eager arrow
severe girder
#

everything i learned is on that site just scroll a bit and you will find examples

severe girder
#

never use that lol

#

so useless

eager arrow
#

what is float ?

severe girder
#

flexbox is so much easier

eager arrow
#

ohh floatt x)

severe girder
#

it is also used for positioning and formatting

#

but it is like a bit of a stertch for certain things

#

you will eventually run into problems with positioning something

#

it might be usefull for having boxes next-to each other

#

like a list

#

but that is it i think

eager arrow
#

i have a friend, he's very good at everything, so he can help me making my website

severe girder
#

i mostly use AI

#

that is my best friend

#

I would not recommend it for beginners in a certain coding language

#

but if you understand what you are doing i dont have a problem with using it tbh

eager arrow
#

i restraint myself from using AI x) i want to learn by myself even if it take much longer

severe girder
#

i cannot restrain my self, i am so addicted to AI

eager arrow
#

i was but now i stopped (still a little bit) using it :)

severe girder
#

i swtiched mayor's now i will try to refrain my self from using it

#

especially with c or scriping in linux

eager arrow
#

you are using C for what?

severe girder
#

ehh fundamentals, prob later we will use arduino ig

eager arrow
severe girder
#

I have created a whole game with arduino i wanted to end it right there

eager arrow
#

so i use C++ for creating cheat for fun

severe girder
#

or sum

#

nvm

#

30

#
eager arrow
# severe girder it cost like 12 eur

i have money but it's just i don't have any coms, it's been one week i don't get any com now, it make me less motivated but i keep going, i keep trying

severe girder
#

but you still need to buy a display etc

#

it is not easy

#

That is something i can tel lyou because you directly talk with the memory

#

call the registers etc

eager arrow
#

oh cool

severe girder
#

i didnt have any fun with that

eager arrow
#

lol

severe girder
#

like i had sleepless nights because i couldn't figure out the frequency of a sound

#

or that it didn't wanted to save my action for some reason

eager arrow
#

arduirno is really hard?

severe girder
#

it depends tbh

#

if you want to learn it you prob have more fun to f around with it

upbeat snowBOT
#

studio** You are now Level 5! **studio

severe girder
#

but we just had to create a game with it and that was my only goal to finish that task

eager arrow
#

i think i'll stay on C++ it's better

severe girder
#

yeah but with C you can do more indept

#

For optimizing it is better to go to C, because you can directly acces the registry etc

#

on arduino

eager arrow
#

people said C++ is the same as C but with typecheking

severe girder
#

on pc etc prob too

#

ig

#

i do not know the details

eager arrow
#

C++ is literaly the same as C but with typechecking and OOP

severe girder
#

Yeah the OOP is a big problem in C

eager arrow
#

but C is used to create lib for C++

severe girder
#

you have to use with Header files like in roblox studio

#

headfiles -> Module files

#

ig you can see them both as the same they both do nothing untill called for

eager arrow
severe girder
#

And with C you have a very minimal lib

eager arrow
#

that why C++ is better :)

severe girder
#

But in C you can use Malloc and calloc, you can still use them in c++ but they arent recommended

#

i just read that

eager arrow
#

300 message x)

severe girder
#

ew ur french

eager arrow
#

yeah sorry

#

:(

severe girder
#

ur my arch enemy

#

i am from Belgium

eager arrow
#

lol

severe girder
#

napoleon did some damage

eager arrow
#

belgium refused chat control right?

severe girder
#

no clue

#

i think so

#

i read that

#

i was so flabberghasted

#

that they were allowing that

#

imagine my sentence would be, the amound of swat's i would have per day

eager arrow
#

if a hacker found a backdoor, they'll see EVERY message and that mean, secret message between hight grade people

severe girder
#

yeah that is true

#

Btw if you are intereseted about malloc and calloc:

Malloc is just a function that gives you a block of memoryu where you can store information. It might already contain information

Whist colloc: clears that block of information

severe girder
eager arrow
#

ohhh okay

eager arrow
#

i'll go back scripting my tank system

severe girder
#

Goodluck is it like a war tank or what sort of a tank😂😂

eager arrow
#

model made by a friend

severe girder
#

Damn is that free

#

Or did u pay for it😂😂

eager arrow
#

the model are made by a friend and the system i'll sell it for 30-50k robux

severe girder
#

Damn

#

Idk even where to start with scripting that

eager arrow
#

lol, that why you should learn to use markdown

severe girder
#

Before i came into the server i thouhjt i was ready to take on servers😂😂

#

Projects*

eager arrow
#

before doing a system, you must already have a list in your head to know what you'll do

#

look, i'm using OOP for my tank system too :) (i'm just starting the script)

severe girder
#

Brodie readss that first line and wants a refubd😂😂😂😭

#

Yeah i see i am now creating a whole game where sphere are shooting out of a cylynder and you have to dodge it.

eager arrow
#

that all the parameter you can change on any tank

severe girder
#

Damnn

#

But how are you going to do the animations?

eager arrow
severe girder
#

I see and doing that in a 180 -180*

#

That wouldnt be that hard ig

eager arrow
upbeat snowBOT
#

studio** You are now Level 6! **studio

severe girder
#

It is so much easier if you have your code structured well

#

Does roblox also work with outside servers for Databases?

eager arrow
#

yeah, you can do request/POST/GET with httpsservice

severe girder
#

But wouldnt that be tracable

#

If not secured good

severe girder
eager arrow
#

yeah is not very secure

severe girder
#

Nrver want to experience that again

eager arrow
#

but httpsservice can be very good, like using webhook, a while ago i made a lib to create a fully discord bot but coding with luau instead of javascript

#

took me alots of time

severe girder
#

Damn

#

Thats insane

#

I am dedicated enough to code my game but not dedicated enough to build or gfx it

eager arrow
#

yeah that the main issue for every solo creator

severe girder
#

That is why i am searching for jobs to generate some robux

eager arrow
#

it's been one week i can't even find someone... it so demotivating

severe girder
#

I am prob going to join some discord servers and ask if they need scripters

#

Like players with 3-4k daily

#

But idk if tvey will accept me with my limited roblox studio knowledge, but maybe they can pardon it with my knowledge overall

eager arrow
severe girder
#

I mean its worth a try, it is very difficult for me to know what the mroce ranges are

eager arrow
#

and be sure you do everyting in your OWN place

severe girder
#

Yeaj but i meant more like how much would that type of work be done. Like they could be offering 5k but it could be worth 10k

eager arrow
#

but be sure when it's a big coms or complexe system, be sure to be more than 10K, and try if you can be paid per hour, the hour you put to finish the system will be the number of robux you get

#

do you understand?

severe girder
#

Yes i understand thanns

#

I think when i finish this game ill apply

#

I have allot to do yet

eager arrow
#

and be sure you have a portfolio or just image of past work you have

severe girder
#

Would you rzcommend posting your works to gitjub?

#

I mean why not ig

#

Thank you for all the help btw

eager arrow
#

np 🔥

summer birch
#

use OOP for systems that should be re-usable and have lots of use cases.