#code-discussion
1 messages · Page 115 of 1
HES MINE ONLY
yuh uh
FOREVER AND EVER
hell nah twin
oh
Money is a stringValue not numberValue
which role?
CEO
Computer Engineer Oxford?
No, Amazon CEO
Pezoz?
Yes Pesos for Bezos
scripter
aww shuks
lf someone who wants to learn how to script with me
guys i need a good front end scripter who can do combat system and cutscenes
how much $
private discussion
Do any of you know about Knit and how to use it?
What are the benefits in using it in contrast to normal studio?
not much benefits
Yup
Why do people use it then?
nobody really uses it
Yo why does studio not suggest autocompletion of values inside a table type unless I look at the type error report
It is just dumb bloat
Trying to simplify remotevents and functions
Why even do that
When they are that simple
@cedar flicker yo can you answer me bacon god
do not use knit
Alright
Dont really get what the problem is :/
wtf?
Is that all it's for?
Yes
It just creates them in the background basically
And a bit more, but i really dont know why it'd useful
I have another questionn, how do I make it so my studio audio fills / recognizes types I make when I use OOP with setmetatables
:
If anyone has ideas they can give me for my website songle.org or any song request that would be amazing.
I think roblox has a pretty good tutorial about it on yt
If im not mistaken
On their official learning channel
I do this @cedar flicker
type InventoryCore = {
Name: string;
Points: number;
Inventory: {string}
}
--then I do this
local playerData1: InventoryCore = {
Name = '';
Points = 1;
Inventory = {'crate'}
}
--my question is why studio doesn't suggest autocompletion on the values inside the table and you need to remember the names inside of the type and this is annoying if I have a modulescript with multiple export types for organization like I need to remember 'Name', 'Points' and 'Inventory'
I have the same problem
Sorry for the ping if u were wanting help
Is it the one from 2015?
you said oop clearly not the same problem
I'm trying to create a toggleable ragdoll module on the server side—yet I do not know the general approach do a ragdoll. Does it only involve storing all joints in the humanoid, breaking them, waiting a second, and then readding them?
it looks pretty similar to what I'm doing
what are you doing
i genuinely didnt know that u can do that
i mean create custom types
You learn something new everyday
I like doing more this inside a modulescript rather than inside a normal script
export type randomBs = {}
return {}
then doing this inside the script
local types = require(typesModule)
local randomStuff: types.randomBs = {}
so I don't have so much bloat in the operating script but the items inside don't get suggested by studio. Though I just noticed 2 ways to fight this, the first being looking at the script analysis report for the names that must be inside and the other one I select the type name and click ''Go to declaration' and it sends me to the module where the type was made.
if I write --!strict at the top of the normal script it will error till I fill all the names correctly though
but it's kinda annoying having this studio limitation
hi i am doing scripting projects(free) for my portfolio if you are interested dm me
yea, your way sounds convenient
yea dude
what does mvntua mean
does it work with strict?
typing strict only makes type checking strict
is there a good youtuber i can watch to start
me
I will teach you how to code using AI
:D
no
seems like a studio issue then, but even without that im already finding good uses in my games
actually if you create new types your script should be using --!strict because otherwise it would be no use and you will not get errors when you're not following the type structure
export type
If u want auto complete out of the module scriot
Use export type = {}
Then get ur type by modulescript.type
@somber vault
think they did that here
stfu no one cares about that mid show
Yo, is 1k for a scripting job of implementing the ui of a painting game lowballing?
what do you mean
If u want ur type accessible out of the module script
Guys du know?
What's the issue
the issue is that the values inside of the type don't get suggested for autocomplete
the type name does get suggested
not the values inside
not the structure
It's not supposed to?
what
Unless ur doing
type idk = {
Inventory: {"crate", "other"}
}
Then crate and other is suggested
yes
But it's a custom type that expects strings in a table for example
hi i am doing scripting projects(free) for my portfolio if you are interested dm me
sounds like slavery to me
So it's not supposed to get auto complete
Who wants to buy my model pet dm me for very cheap!
shouldn't you do Inventory: {string}
I know but not trying to be flashy here
I just want the indexes to be autofilled not the values bro
So inventory is expected to have strings inside of it
like Name or Inventory
Ok what r u tryna do
get commissions one day
Fr
ts took me way longer than it should've 💔
https://devforum.roblox.com/t/handling-tens-to-hundreds-of-enemy-ai/3788961?u=thatguybarny1324
need a little help
The gameplay loop requires that there be a very vast amount of enemy AI for the players to encounter. The only issue in my thought process is how I would not only handle everything (AI script + Statemachines and other things like animations and positions) but also optimisation of the enemy AI too. I was thinking of handling the AI all on the ...
the world would be better if THIS was possible
No wait ill search it up
Dive into the OOP paradigm and how it works within Luau.
For more, check out these links:
https://create.roblox.com/docs/luau/metatables
https://luau.org/typecheck
Chapters:
00:00 Intro
00:24 What is it?
01:36 Why do I care?
02:01 How do I it?
02:31 Example
03:25 Tangent
04:07 Example pt 2
09:59 When should I use it?
bet
Cant open it
Uh i learnt it from TheDevKing he is best
@lone marsh
guys i need help. how do i add katana animation? currently, the katana does not swing even though there is an animation on it
this is my function for putting katana into the player's hands
and here are the animations for it
:Play()?
Are these good?
hey I need help from a bot developer again
yo
yo
it does play in the video
Ive been working on my bot
my question is that how can i play the animations from katana as well
finally I am able to interact with it and everything
thanks to your help
however I am running into a couple of issues
need some vfx there 🙏
right now I am trying to implement a simple roblox verification system
Did u make the character the exact same as the rig
I have made good progress
Like is everything named properly
it's supposed to look like this
In the right location
yessir
however I decided to use Supabase as my datastore
that's how the rig is playing the animation
supa what
and honestly it is not really working out
only the katana is not playing
supabase
Ok but compare the character ingame to the rig
what the issue
do they have the exact same things
well its not connecting
u need to be really precise with motor6d
to supabase
I tried doing direct connect
and I tried doing API
and I am just running into a wall
yeah its basically failing to connect
show code
do you know a better datastore option instead of supabase?
like somewhwere where you can store verified user data?
well i always hear abt mongodb
You asking or saying? Cause I know, I’m new to scripting so I’m like just having fun with it
the concept is good but u need some visual
Thank you mate ❤️
For people who speak other languages, do they have to learn English in order to learn how to script??💔
no
Is it auto-translated?
i code in english
english come along the way no need to learn it but yea you have to
that would be a nightmare if the code is auto translated
Thats what i was thinking lol
Then login
Would never work anyway as I’m pretty sure all code follows a standard and that standard being English 🙂
Pretty sure English is the global standard language or at least the most popular choice for a second language next to your primary if it’s not your first
can someone help me with this code please? local washingtonparts = script.Parent:GetChildren()
for index, value in washingtonparts do
if value:IsA("Part") then
value.Color = Color3.new(0, 0, 1)
end
end
local function onWin()
if script.Parent.Color.Value == "Blue" then
for i, v in washingtonparts do
if v:IsA("Part") then
v.Color = Color3.new(0, 0, 1)
end
end
elseif script.Parent.Color.Value == "Red" then
for i, v in washingtonparts do
if v:IsA("Part") then
v.Color = Color3.new(1, 0, 0)
end
end
end
end
script.Parent.Color.Changed:Connect(function()
onWin()
end)
So I need these cones to always weld right at the hands position, which technically they do but the idle animation messes up the positioning
how could I fix this?
why you being moody
If I were to look for a scripter to script a similar game like grow a garden (just a reference) how much am I looking to spend on them?
yeah i hate my life too
anyone got suggestions for features for a Roblox Discord Security Bot?
ask ai blud
why is this killblock not working? (my parts name is notpart)
around 100k Robux
Part.Touched:Connect(function(hit)
end)
currently on mobile but it should be like that
i did hit = Part.Touched instead of them
arent they the same
Part.Touched is an event that happens, you cant define an event using a variable so you need to do
Part.Touched:Connect(function(hit)
if hit.Parent…..
end)
you should not define hit above as it is already defined in the function (hit)
tysm i didnt know that i couldnt define an event with a variable
honestly it would range more
Creating a game like grow a garden is not easy
in my opinion it would exceed 180k+
right
would you say that the effort needed to code grow a garden is around the same effort to code something like Dusty trip?
or is dusty trip higher effort
Grow a garden is higher effort
how so
There are cycles, integrating every plant, each cycle, mutation s, grow boosts, plant size, etc

Grow a garden is higher effort than a lot of games
Grow a garden would take allot of time, since every plant has to be integrated with its own models and cycles
Especially anime fighting games
ty ty
Im not entirely aware of what goes behind each game, so I was trying to make sure to give a decent example
chat is this troll
now that you put into words, im more leaning towards a game like dusty trip. Would the budget still be somewhere around 100k Robux/ $360 usd for the whole game?
coding part*
this one doesnt work as well do you know whaat i did wrong this time?
not the whole game
Tf
Why he is making my life harder
the if should be above the end
depending how advanced you want the game, it all relies on the quality and size you want it at
anyone got some simple project ideas just to practice my scripting skills?
delete the end) and place it below the other end
oh ok ty it worked
is there any way to get like a signal when players footstep happen
useless doing getchildren() since for i,v loops through the children anyways
are you for real
how do you even come up with that result
how does it cross your mind to write the code outside of the connection function
there's a thing called scope. The value obtained with the touched event is only accessible inside the scope of the connection function
i started today
why are you at the f*cking built-in functions on the first day
He is new give him a chance
Chill on bro 😭
learn fundamentals before anything else
no wonder you made the worst mistake I have ever seen in this server
This has to be ragebait
Grow a garden was made in 3 days by one guy 💀
How do I turn my datastore leaderstats script into profilestore?
local DataStoreService = game:GetService("DataStoreService")
local PlayerDataStore = DataStoreService:GetDataStore("PlayerData")
game.Players.PlayerAdded:Connect(function(Player)
local Leaderstats = Instance.new("Folder")
Leaderstats.Parent = Player
Leaderstats.Name = "leaderstats"
local Cash = Instance.new("IntValue")
Cash.Parent = Leaderstats
Cash.Name = "Cash"
Cash.Value = 0
local PlayerData
local Success, ErrorMsg = pcall(function()
local PlayerId = Player.UserId
PlayerData = PlayerDataStore:GetAsync(PlayerId)
end)
if Success then
if PlayerData then
Cash.Value = PlayerData[1]
end
print("Data loaded successfully")
else
warn("Error loading data: " .. ErrorMsg)
end
end)
local function saveData(Player)
local PlayerId = Player.UserId
local PlayerData = {
Player.leaderstats.Cash.Value
}
local Success, ErrorMsg = pcall(function()
PlayerDataStore:SetAsync(PlayerId, PlayerData)
end)
if Success then
print("Data saved successfully")
else
warn("Error saving data: " .. ErrorMsg)
end
end
game.Players.PlayerRemoving:Connect(function(Player)
saveData(Player)
end)
game:BindToClose(function()
for _, Player in pairs(game.Players:GetPlayers()) do
saveData(Player)
end
end)
while true do
task.wait(60) -- every 60 seconds
for _, player in pairs(game.Players:GetPlayers()) do
saveData(player)
end
end
i watched videos now im trying to do it myself
Look up Riley bites tutorial
i dont even think my datastore script saves and loads correctlu
You know that roblox games are built on modulescripts to do every system? ''since every plant has to be integrated with its own models and cycles", and do you think that takes 10 hours to do? No. It takes 10 minutes to Implement the fruit with modulescripts and change the time formula. Grow a garden does not take a lot of time. Once you have made the core logic with modulescripts making updates takes no time
What videos did you watch
@somber vault do you know replica by loleris
thedevking's Beginner's Roblox Scripting Tutorial
Fuck off man
Stop spreading library cancer to people
Esp beginners
Why the fuck wouldn't he use it
not started to study frameworks yet as I'm learning type checking and then I want to practice more oop then I want to study frameworks. Why?
Ur not cool gang
Because it's easy to use and it's better? And it's faster then making ur own
how though
Was just asking
Bro if u look it up u can see it ur self 
Use ur words to explain it
It's made by people with years of experience. Clearly there are improvements than regular roblox's datastoreservice
session-locking, big scalability, easy to learn and to setup
big scalability
explain what this means
it has session locking and auto saving and its proforment
what's the upside to session locking
what are these questions bro
discussion
it takes a simple google or youtube search to answer your questions
So many questions bro
These arent out of curiosity
I'm interested in what your response is
what is the benefit you get from session locking?
bro uses profile store and doesnt know what session locking is?
Like I said I haven't studied frameworks yet. I can say what the roblox devforum post says. So I cannot give you a professional response to that question or anything technical to it.
🗿
Hey I was wondering if anyone could help me so basically I had click detectors on my game they worked fine until I made a new place in my game then like 10 min later they all stopped working in my whole game like there is no mouse icon change or nothing its like they dont exist but they do
The funny thing is that there are so many ''steal some shit'' games rn and every one of them is literally built on the same systems it's literally a copy and paste except the models change and that's it
Who's paying you to be an advertiser for these libraries man?
Why u on him bro get a life
I said what the devforum post said
Do people get the scripts from somewhere
or do they code them theirselves
so like, youd just read off whatever
Like its a fact
the post tells u benefits of session locking .-.
What is your purpose here?
''Like it's a fact''
Yeah bro
What's up with these r*tarded claims
By saying it without a qualifier you're asserting it
And you're asserting it without knowledge
Frameworks are built by people with years of experience that know more than you. And there are a lot of youtube videos covering profilestore and also datastore2
where did u get the steal a script from that everyone using @somber vault
I think it's just the same devs with a different name for every game or there's a discord server where people buy the template
Define framework
might be a knit user
Damn so ur telling me I cooked myself making a 1250 line metatable
metatable? What the fuck?
structured and reusable codebase that provides tools, patterns, and pre-built systems to help developers build games more efficiently and consistently
Chatgpt
also profilestore doesnt fit that
so
I made the steal a characters as objects
That I can call metamethods on to change their state
:changestate()
That's a method
bro this guy is ragebaiting. Clearly doesn't know anything about coding if he doesn't know what a metatable is
Ik
What he described is an object
I know what a metatable is what
not a metatable
this bjcs dude
It's actually funny because I know a youtuber that is making the popular games on his own doing 'asmr coding'. He made grow a garden and is now making steal a brainrot
you may have implemented it with a metatable
But its a class and methods
Not a metatable or metamethods (separate concepts)
Oh what I watched it, it was kinda good I learned Abit of things from it
I see
a class and method
anyways I use class to make object which I then spawn in its distinct states then I script processes to switch states
Classic response of a 14 year old trash talking in discord when he doesn't know what he is talking about and doesn't even bother reading what I said. Just the ''Ain't reading all that'' left for the cherry on top.
What you wrote was ai generated
I dont have an idea for a small coding project to do to start my portfolio up, any ideas? not too complicated but not baby level
tell me what makes you think that.
the fact that its incongruous with what youve claimed
Do u guys think it would be cool if I added a fighting state to the object class
Also that you said you need to "study frameworks"
so u can fight the stuff u get on the conveyor belt and steal
Either chatgpt or copypasted
proves nothing
I dont need to prove anything lol
all frameworks are tools to help developers structure their games more efficiently and fast
no need to know all of them to know the definition
ProfileStore isnt a framework man
maybe not a framework
But it is a goat work
i can save my data without it breaking
You can do that with anything
it doesnt though
have u test it
what about for duping and stuff
Don't feed this guy ragebait he's wasting people's time.
He proving while the profile store is not that good let him cook
98% of dupes are not anything profilestore protects against
I need to hear this
Im not saying anything like its bad
Btw
what they use to dupe then
Im challenging dogmatic views of programming
its called rollbacking
bro saying he has been scripting before 2018
rollbacking?
Since 2015, actually
Don’t time move in one direction though just like how a datastore save data
Not unless it can't save the data
bs. Anyone with more than 4 years of experience is not in this server of nobodies
Then it can’t save the data of duped person
Yes, the save isnt done
Except in a trade
You take from the glitched guy and give it to someone else
But if the glitched guy cant be saved
.-.
is this cool?
The trade isnt complete
my profile: BJCBOSS
🙏🙏🙏
🖐️
why this a cook
But then the item not go to the guy who get it
trade not complete = no item exchange
no item exchange = no dupe
It does though
how
what is your portfolio guy with 10 years of experience
Because the save failure doesnt actually block the trade usually
what if u check data when the trade completes
data required same frame trade start and trade end
So the issue is that you have to know if the save failed
which most ds libs hide from you
I don't have one
im not doing comms or anything lmao
local data1 = getdata(player1)
If not data1 then return end
local data2 = getdata(player2)
if not data2 then return end
—data add and removal here
why this not work
what is getdata?
in this
gets my data from the service
From profilestore?
so how come you have a decade of experience but don't know metatables
i do though
ya it’s an example
sure, so those return a cache
how can you not have work to show if you have a decade of experience
what have you done in a decade
u have point there actually…
made games
U'd need to be able to revert data as if the trade never happened if at any point the save fails or player leaving is detected before it goes through
where the game at
play war tycoon
tell me 1 game you made
U revert nothing cause the trade consists of viewing data until it’s completed where u extract it
ur never touching it outside of the final process
im not out here solo making games man
why is that a problem
play war tycoon, i worked on it for a couple years
U need to revert if 1 player fails to save due to datastores
1 player saves other doesnt then u revert player 1
These are called transactions
U check on the final process if it’s in the data
then u remove it if the other player also has data
U still need to revert if it goes through for 1 player and not the other
Because at that point 1 player already has it saved
yea but u just cancel the whole thing if no data for one of the players
The ideal implementation is external verification as part of a library or similar
U cant cancel it if 1 player has already saved
Right but most datastore libs make it hard to detect save failures for a revert
Ur working with datastores where that can happen
I don’t think u understand what I’m saying
Be it via an outage that happens
or a rollback with broken data
if they save it doesn’t matter because they ain’t getting anything done to their data unless it’s there
And only when the other players data is there
You can check a save on player a before modifying player b
thats fine
What im saying is when ur saving player 1 and player 2 if any 1 of those fail after 1 has already been saved u need to revert the player that has already saved
U cant predict that till it happens
couple years on a tycoon?
Have you ever played it?
And the game was out during that time lmao
profile store will not return the data if I can see it’s not there
what's the name of the creator
Or not working right
search war tycoon
Thats not what im saying
it will though
who's the creator
Im saying if 1 player goes through successfully but the other fails
Why?
U need to set back the player that went through properly
its literally the first result
Return end
no operation
Return end when player 1 has their data already saved and player 2 hasn't
Ur quite literally creating a dupe right there
you cant do one without the other
If you do, the outcome is either a dupe or data loss
no data for player 1 return end
no data for player 2 return end
player1.Inventory.Apples -= 1
player2.Inventory.Apples += 1
This isnt about no data
how I dupe that
Its about datastores failing
what if player1 doesnt save
You didnt check for that
U need to revert the data
Yes and u need to revert if 1 player fails because u create a dupe or dataloss
my point is profile store is perfectly fine but if u over complicate it then ur gonna make a dupe
the game was out during that time
its gradual
It isnt overcomplicating this is the basics in preventing dupes
this dev stuff so hard when u have to learn every skill….
but you're just a yapper so i get why you'd confused be
tell me another game you made
how do i make a game like steal a brainrot
I'm not prove my experience to you man
u probably wanna buy a script for that
if u don’t code
no i mean where do i start
saying that as someone who made the script
yea
how come your discord account was made in 2021? Don't you have a decade of experience?
It work good I take into account player leaves
reasons
what script
Resets
you're bullshitting
bullshitting what
All the problems u encounter
what problems
My roblox account is literally that old
who gets the ownership from stealing
player gets ragdoll
was it hard to script
slotting
yes
decade of experience and you should have connections to all front page game devs
dang wait for which game did you script it for
I had to do a lot of thinking
My own game
dude just quit talking
can i test
You're literally a drone
yea sure give me a sec
bet
10 years printing hello world
how many active players btw
alr bruh im just blocking you
I haven’t published yet lmao
oh alr
Im basically solo deving the entire thing
wait whats the name of your game
You're literally never gonna be worth my attention
Does :Destroy() on a bindable event, remote event, function, etc.. destroy the connections automatically with GC?
what percentage of the game have you completed already?
80%
Destroy disconnects them
dang bro your nearly finished
GC comes later
when did you start making it?
2.5 weeks ago
Im basement coding
whats basement coding mean
oh unlike you I'm actually working everyday to build a future career. Not spending 8 years playing with free models. Soon I'll leave this server of nobodies
too locked in
Im taking a break so my eyeballs don’t explode
oh alriht
but whats the name of the game
and how much players do you expect the game to have on release
If I could get 100 that would be goated
also are you going to sponsor it?
ya im gonna ad it
basement coding is hilarious
damn nice whats the name of the game btw
idk yet
you said earlier you're 80% done
I fw u rexwolf, u eager to learn stuff
I show u
nah hes eager to grind
80% done with a game he started on 2.5 weeks ago
bro is locked in
Whats the best way to replicate guns onto mobile in terms of getting the direction to cast the ray?
RemoteEvent
??
wsg
join
is testing via play (solo) unreliable vs pressing run w the server and 1-2 clients
i have a bug that shows up only in play (solo) but doesn’t show up when i press run with 2 clients 💀
Anyone else having a weird issue with context action service not working when binding to leftclick?
-- Registering the keybind for the action
ContextActionService:BindAction("ActivateMiningMinigameButton", function(actionName, inputState, _inputObject)
if inputState == Enum.UserInputState.Begin then
print("Activate")
end
end, true, Enum.KeyCode.MouseLeftButton, Enum.KeyCode.ButtonA)
It works fine when i press "A" on the controller, however it does not trigger with the mouse left button.
Enum.UserInputType.MouseButton1, not Enum.KeyCode.MouseLeftButton
The latter is for InputBinding instances
Thanks, good to know 🙂
i need some help im trying to get a npc to move after i put in a dialog option like enter game then i want the npc to move somewhere but i cant figur out how to do it
for i ,v in pairs(Teams:GetChildren()) do
if v == 'Police' then return end
if plr:IsInGroup(32346841) then
if t == Police then
plr.Team = Police
plr.Character:Destroy()
plr:LoadCharacter()
end
end
end``` How do I get it so if a player is already on the team and they select that same team it doesn't reload them
Check if the player is in a team and if the player's team is what they chose
If so, do nothing
if t == Police and plr.Team ~= Police then
I don't get it
ty
then go to #scripter-hirable
Is it possible to post in there if I just volunteer to be the scripter (not so experienced coder)
man, do you have any performance tips for this, like, you can see that big brushes make the game slow, but I have no idea how I can increase performance, only if I skip some frames or I just limit the size of the brushes the user can use
I can also try to implement a better "completing" algorithm
No matter what I do I can't change the moon texture it's just white all the time
https://github.com/Anaminus/roblox-library/tree/master/modules/Bitbuf absolutely goated fuckin library, I would even say it's better than the built in buffer library
how do i make a particle show when the player touches something
Part.Touched
I mean isnt this built upon the Roblox buffers
how do i make it emit an amount of the particle like that plugin does
Emitter:Emit(Count)
alr
Dm pls I want to say something
was scripting and then the autofill decided it wanted the button to be for a gamepass
is ts tuff??? game is public rn also if u wanna try dms
i made so that when left shift is pressed it strts to sprint but i cant make it that when left shift is realised it gets normal speed
Can someone explain how in for loops, how does in pairs works despite only having 1 type of arugement
Means u want everytime sprint that character runs only with w no need of pressing shift
🙂
What are common facets of network bandwith overload and memory leaks and how would I deal with them?
High bandwidth usage often surrounds incessant networking, the delivery redundant information, the delivery of too much information at once, and an inappropriate delivery method (TCP Vs. UDP)
Memory leaks are some of the most notorious bugs to squash. By definition, they're an ineffective use and release of memory
Memory leaks in Roblox are often caused by embeded or unmanaged event connections
Physics
Using Roblox physics is great and all but you do have to replicate every change
Gets expensive quick
So I have a main menu frame with buttons when i press one of the buttons a pop up appears and it hides the buttons underneath it but i can still interact with the hidden buttons how do u avoid these kinds of problems
Make it visible = false
If only want it just visible but can't interact just do interactable = false
Alright thanks for the help will do that
Rotation *= CFrame.Angles(Input.Delta.Y/10, Input.Delta.X/10, 0)
AlignOrientation.CFrame = Camera.CFrame * Rotation
I want to make this rotate relative to the camera rather than the object, this is probably a really basic cframe thing but i just cant think right now 😭
Rephrase
this(?) the object(?)
pairs is an iterator factory. It produces a function that traverses the given table. Unbeknownst to most Lua(u) scripters, generic for loops are actually structured like so:
for ... in iterator, table, argument do
Three values are found in between in and do. The first is the iterator function, the second is the table it iterates with, and the third is a single argument that is passed to the iterator. Lua(u) is designed this way as its native iterators were manufactured to be stateless. Given a table, pairs will produce the following output in alignment with what's said above:
print(pairs({})) -- function: 0x0000000000031988 table: 0x000000000002f568 nil
If you capture the function, and provide it with the proceeding return values, you'll get the first key/index-value pair:
local numbers = {1, 2, 3, 4, 5}
local iterator, a, b = pairs(numbers)
print(iterator(a, b)) --> 1 1
So what is a and b? a is a reference to the numbers table—you could swap it out with numbers itself and see no difference. b is the key/index of the pair you're currently observing. pairs uses this key/index to move onto the next pair. nil is the first key/index as no pair is being observed until the iterator is first invoked. With this knowledge in mind, we can extrapolate and monitor how the iterator works step-by-step:
local numbers = {1, 2, 3, 4, 5}
local iterator = pairs(numbers)
print(iterator(numbers, nil)) --> 1 1
print(iterator(numbers, 1)) --> 2 2
print(iterator(numbers, 2)) --> 3 3
This is what the generic for loop does. It will continue to call the iterator each loop, providing it with the table constant and the first value the iterator returned from the previous iteration, which is conventionally the key/index of the pair.
omg shut up
Technically he's speaking very little because it took like 30 minutes to draft that response
Bro put an entire text wall down
i have a model which i can grab and move around with my camera, thats the object
what does this mean ServerScriptService.UnitModule:51: attempt to index nil with 'Name'
If you can't handle that degree of a breakdown, then you're cooked 💀
I see
People's attention spans are getting scarily weak
i can send you a video hold on
It means your code executed: nil.Name
Whatever precedes .Name is nil
Bro my entire phone screen got covered by ur textwlall
Mouse delta is the rotation direction relative to the camera's pov on the object
I'm not even trolling
how do i fix the error
can anyone help with my code!??!?
local function pairs(table)
-- Enclosure to keep outside variables
return function()
-- Recalled each iteration
end
end
variable called choosenUnit isn't exist yet
buying a shirt from a proximitypromt can anyone help with this?
local prompt = script.Parent:WaitForChild("ProximityPrompt")
local ShirtTemplate = "rbxassetid://12151887132"
local price = 5
prompt.Triggered:Connect(function(player)
local stats = player:FindFirstChild("leaderstats")
local cash = stats and stats:FindFirstChild("Cash")
if not cash or cash.Value < price then return end
cash.Value -= price
local char = player.Character
if not char then return end
local old = char:FindFirstChildOfClass("Shirt")
if old then old:Destroy() end
local shirt = Instance.new("Shirt")
shirt.ShirtTemplate = ShirtTemplate
shirt.Parent = char
local humanoid = char:FindFirstChildOfClass("Humanoid")
if humanoid then
local desc = game.Players:GetHumanoidDescriptionFromUserId(player.UserId)
desc.Shirt = ShirtTemplate
humanoid:ApplyDescription(desc)
end
print("✅")
end)
and howw do i fix that
This is an example of a stateful iterator
I'm not sure, I think you would use the method to rotate around an axis but I'm stuck at the step where you take mouse delta and turn it into an axis in 3D
yeah but when i apply the rotation to the alignorientation, it just adjusts it relative to the object so like if i want to rotate the part in the y axis, it rotates the part around the parts y axis
hard to explain please excuse my shitty explanation
ill send a video wait
You wrote chosenUnits, where you mean to write chosenUnit
make that variable exist with
local choosenUnit = you need to insert things here
output?
sure
when i buy a shirt my old shirt gets deleted but not changed
its a bit of a mess im really sorry
I think I got it, you rotate it on the up vector and right vector of the camera
by x and y of mouse delta
or I guess first convert delta into screen scale
10:50:26.796 ✅ - Server - Script:29
i changed to chosen unit now this pops up
D print() at line 51
Object.CFrame *= CFrame.fromAxisAngle(Camera.CFrame.UpVector, mouseDeltaScale.X)
Object.CFrame *= CFrame.fromAxisAngle(Camera.CFrame.RightVector, mouseDeltaScale.Y)
@hardy pilot
omg thanks
@young rock
local mouseDeltaScale = Vector2.new(
mouseDelta.X / Camera.ViewportSize.X,
mouseDelta.Y / Camera.ViewportSize.Y
)
also I guess add a multiplier as sensitivity
what is the problem now
Should be value type issue
10:49:35.963 value of type string cannot be converted to a number - Server - Script:25
10:49:35.963 Stack Begin - Studio
10:49:35.963 Script 'Workspace.ShirtBuyPart.Script', Line 25 - Studio - Script:25
10:49:35.963 Stack End - Studio
10:49:35.964 ✅ - Server - Script:29
You're using LocalPlayer?
How do you define player?
T^T
Chudover
can some one give me a simple system i can do for practice
idk im new so dont understand most of it
Then you're way in over your head
What is your experience?
just started been learning for like 3 weeks and getting no where
it does the same thing
Are you using it right?
im not sure hold on
Where can I join the project (just volunteering)
What do you know?
pretty much the basics like fuction stuff like that
yall think I can learn how to script entirely from ai?
might not
go for it but iv tried everything
@hardy pilot
local mouseDeltaScale = Vector2.new(
Input.Delta.X / Camera.ViewportSize.X,
Input.Delta.Y / Camera.ViewportSize.Y
)
Rotation *= CFrame.fromAxisAngle(Camera.CFrame.UpVector, mouseDeltaScale.X * 100)
Rotation *= CFrame.fromAxisAngle(Camera.CFrame.RightVector, mouseDeltaScale.Y * 100)
AlignOrientation.CFrame = Camera.CFrame * Rotation
100 rotations per one screen swipe?
its too low
Yeah you're doing it wrong
You're adding the rotation to the camera
Why would you add it to the camera and not the current object cframe
i use alignorientation
who can see the problem here because cannot
issue with variable defining
@hardy pilot
AlignOrientation.CFrame = (GrabbedObject and GrabbedObject:GetPivot()) or CFrame.new() * Rotation
This doesnt work
can you send the whole code
CFrame.identity 💯
What the fuck is this 😭
AlignOrientation.CFrame *= Rotation
it does the same thing
(is nil)
Show me again
how do i fix that
Don't make it nil
Get a valid reference to a real player
Camera:GetPropertyChangedSignal("CFrame"):Connect(function()
AlignPosition.Position = (Camera.CFrame*CFrame.new(0, 0, -5)).Position
AlignOrientation.CFrame *= Rotation
end)
and how do i do that
This is the first episode and beginning to become a Roblox Scripter/Game Developer! With 3 playlists (Beginner, Advanced, GUI) containing 50+ videos and 30+ hours of content, I will guide you through this journey to start making the games you want to create on Roblox!
DISCORD 📜
Join my Discord Community if you want scripting help, participat...
okay thanks
and the rotation is just a blank cframe added with the two rotations?
very weird avatar
local Rotation = CFrame.new()
table.insert(Connections, UserInputService.InputChanged:Connect(function(Input)
if Input.UserInputType == Enum.UserInputType.MouseMovement then
if not IsRotating then return end
local mouseDeltaScale = Vector2.new(
Input.Delta.X / Camera.ViewportSize.X,
Input.Delta.Y / Camera.ViewportSize.Y
)
Rotation *= CFrame.fromAxisAngle(Camera.CFrame.UpVector, mouseDeltaScale.X)
Rotation *= CFrame.fromAxisAngle(Camera.CFrame.RightVector, mouseDeltaScale.Y)
end
end))
oh Input.Delta is a thing? Didn't know that
Well it's kind of wrong
because I meant for you to create a new rotation cframe for each mouse movement update
Go ahead and make a garden game then
You're stacking up into one cframe which means it should spin out like crazy the longer you move it
or well, at least start moving in a really weird unpredictable way
🤔
Maybe I don't understand fromAxisAngle
Where can I find the project to join as a scripter (volunteering)
I kinda need to get more experience
Nowhere
@hardy pilot brb
everywhere
No one wants a game coded by a beginner obv
Those who are willing to wont give you any valuable experience
unless Ig theyre tutoring you
but then thats not volunteering
ive worked as an unpaid scripter for 2 years to gain experience
then used that experience to make some actual money
For who
groups that are almost non existent now
@hardy pilot
?
What do you do in specific?
I'm sorry wrong ping
what is the difference
My career always focused more on scripting stuff for military games, but now im getting more into scripting normal games
@hardy pilot ill just start from scratch and try to figure stuff out
about the rotating system
You said it still rotates to some default?
i was watching a tutorial but i dont understand why its says that because i did it exactly like the tutorial i think
Wdym
Like what does it do
Oh ok
right now?
It means that you're attempting to look for (index) wait for child in a value that is nil
so player is nil
player could be nil because you're getting the reference wrong somewhere else
okay thanks imma look for it then
Usually portion of games since I work more commission based cause thats what makes me more money, but ive been working on scripting full games.
What does it do with the code you last sent
i dont really know its really glitchy
So it spins in the correct direction?
rotates the y axis when i move my mouse on x
nope
in the other direction?
it just does the same thing, rotates relative to the part
🤔
can the mistakes be in other scripts
do you have an example of what you want in some other game or media?
let me see
Would you say if someone who hasn't done commissions before but has a butt load of projects and showcases were to start doing commissions do you think they would get an influx of requests?
Yeah
What's most sought after, scripting-wise?
Can you send the whole code from line 1 to the last line especially with player variable line
Though most public commissions are garbage
Doing public commissions is practically volunteering most of the time
A really easy niche in my opinion are roleplay games like military
It's usually a bunch of disconnected systems
that are easily resold
If the projects are high quality, yes. but people wont come after you if you dont work somewhere, you need to look for people that are hiring
Yeah thats exactly where I focus
I work on my own military projects to resell or I make them for people who pay high
@near pasture which I would actually recommend for experience I guess if there wasn't like a 30% its a scam
at least in my experience they were really horrible
Whats a public commission and a private one?
Like getting connections?
Like being recommended to someone
I'd assume you need to do public to get someone to recommend you first
Well
yeah it could help you
like you can meet someone who isnt a complete amateur
and then have them recommission you often and recommend you
but it is gambling
I don’t work for public unless they are a reputable person
aint risking being scammed for a months work
Does 50-50 prevent scamming?
Indeed, but when I work I keep all scripts on my own studio and we exchange at the end, were of course he has to pay first
No
also even beginning a commission is a skill if it's from #scripter-hiring
theyre usually extremely underprepared
have no idea what they really want
no assets ready whatsoever
and their game is probably not going to be on your portfolio as a proud piece
Thats what happened to me, I received all assets on June 1 (formerly submission date of when I finish since I have exams after june 1) so I had to work with place holders then eventually left the project due to exams
@hardy pilot maybe i should just add press R or T to rotate
Works too lol
i couldnt find a reference but i just wanted to make it look like im grabbing the object and rotating it
i still cant find the problem
I see the error
You forgot to define player variable
did you fucking use wait for child in a serverscript
nvm lol
i just read the error
?
u have to wait for replicated stuff in server scripts
So basically the word "player" in there is currently some random word not variable cuz you haven't define it yet
either ur trolling or dont know basic replication
@scenic lotus Let's be friends!
check the function parameter
oh
then it should be the problem when calling function
should be
okay
Debug simple print player then print the unit
but what i dont understand is i have followed a tutorial and done the same things just like the tutorial and he also has player written
how
Not all the time they work
oh
Did u really make this module
Where you have clone.Parent = player:Waitforxhild() whatever there print that as well
It looks like chat
i followed a youtube tutorial
Print this as well
i dont understand what you mean
any scripters down to brainstorm an idea then make the game and split it 50/50, ill pay for ads and do everything else but scripting, dm me
print(player.Units)
and what does that help??
To see if it exist
above line 56
okay
and look at the output
print(player) too
run the game after that and look at output
it doesnt say anything
?
Which script that use this module?
then need to look at the script that use this function from this module
wwhat do you mean
other scripts
like this?
is it module.ChooseUnit(player, folder)
and how do i fix that
is it better to master front end or backed first?
and where do i type that
You can actually use Player since remote event already gives the data
Player instead of player
can someone give an opinion to my question please?
like this'
what is front end and back end tho
?
ye and try running the game
dammit why is my script not working!!
those and 2 types of scripting like client based or server based
when i press the summon button noting happens