H e l p
I did everything just like you said
H e l p
I did everything just like you said
Can I see the code plus coroutine doesnât really reduces lag, but if your doing these type of loops looping through heaps of object, it is needed because it would get a script timeout, because it blocks other script. Like imagine if you had to multi task heaps of things at the same time, thatâs basically what the computer does so thatâs why itâs needed to have coroutine on these loops.
do you know what that error means?
nope, I have no clues what it means
Well
for _,Target in pairs(game.Workspace:Descendants()) do
if Target:IsA("Humanoid") then
local hum = Target
print("Humanoids Found")
end
not what heâs looking for, he want a way to reduce lag, unless Iâm reading the code wrong or smth
How i get this âplayersâ in a server side?
game.Players:GetPlayers() returns a table of every player in your game.
i need to put something else in that pairs how do i do it?
you mean a like this?
for i,v in pairs(game.Players:GetPlayers())do
end
No, it sure is wrong but it is the way to represent what I want
for i,v in pairs(game.Players:GetPlayers(), Workspace.Npcs:GetChildren())do
end
for i,v in pairs loops through tables. if you want something like that youâd have to create a table then add GetChildren() and GetPlayers() to that table. Also, GetPlayers() doesnât return a table of their player models, it returns their player instance which UI is stored in.
so ⌠what if i tell you i donât know how to make tablesâŚ
theres the wiki page for it, it has way more info than I can really give you.
read a little and I would do like this
local Array = {game.Players:GetPlayers(), Workspace.Npcs:GetChildren()}
for i,v in pairs(Array)do
end
youâve got the idea of it. but doing :GetPlayers() and :GetChildren() returns tables. so you just made a table of 2 tables. youâd have do 2 seperate for i,v loops and just add v to the array table.
local Array = game.Players:GetPlayers()
for i,v in pairs(Array)do
end
I need to add a
game:GetService("Workspace").Npcs:GetChildren()
in this for
youâd have to loop through that table and add it to a seperate table with table.insert().
it is very confusing for me, could you explain in more detail?