generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: need help with optimization

Previous Thread :: Next Thread 
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Dec 2016 11:55 AM
so i have these ai that walk around and slash at the closest player

but when i have a bunch it starts to lag real bad

is there a way to reduce the lag or get rid of it


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Dec 2016 02:31 PM
bump


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
SirTipsAlot is not online. SirTipsAlot
Joined: 08 Feb 2012
Total Posts: 2431
30 Dec 2016 02:32 PM
any loops?

if not set the network owner to the server and see if that reduces the lag


Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Dec 2016 02:34 PM
@Sir

i don't think so

also what do you mean


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
Ambitious_Pilgrim is not online. Ambitious_Pilgrim
Joined: 29 Mar 2015
Total Posts: 4657
30 Dec 2016 02:39 PM
by loops he means like

for i = something

while true do
Report Abuse
SirTipsAlot is not online. SirTipsAlot
Joined: 08 Feb 2012
Total Posts: 2431
30 Dec 2016 02:40 PM
assume tab is a table with all the bots

for i,v in pairs(tab) do
for j,k in pairs(v:GetChildren()) do
if k:IsA("Part") and k:CanSetNetworkOwnership() then
k:SetNetworkOwnership(nil)
end
end
end

try that


Report Abuse
SirTipsAlot is not online. SirTipsAlot
Joined: 08 Feb 2012
Total Posts: 2431
30 Dec 2016 02:41 PM
side note: the bots might load slower because it loads on the server first, but hey if it reduces lag go with the flow


Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Dec 2016 02:45 PM
######################################################################################################################################################################################################################################
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Dec 2016 02:46 PM
######################################################################################################################################
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Dec 2016 02:46 PM
################################################################################################################################################################
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Dec 2016 02:47 PM
# ## ## ## ### /c8782d1a93d6aa9dd527c74c7c736ceb this is what i mean Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Dec 2016 02:47 PM
wow this filter it's a ##### link /c8782d1a93d6aa9dd527c74c7c736ceb Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Dec 2016 02:48 PM
gee

y

a

zee

o


/c8782d1a93d6aa9dd527c74c7c736ceb


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
SirTipsAlot is not online. SirTipsAlot
Joined: 08 Feb 2012
Total Posts: 2431
30 Dec 2016 02:53 PM
are that many npc's necessary?


Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Dec 2016 02:57 PM
"are that many npc's necessary?"

well the rounds are going to spawn noobs out slowly

probably up to like 150 for the final stage

im afraid this is going to be a problem


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
SirTipsAlot is not online. SirTipsAlot
Joined: 08 Feb 2012
Total Posts: 2431
30 Dec 2016 02:58 PM
did you change the network ownership to the server

if you did, did it help?


Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Dec 2016 03:00 PM
i put this script in every noob

for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA("Part") or v:IsA("UnionOperation") then
if v:CanSetNetworkOwnership() then
v:SetNetworkOnwership(nil)
end
end
end


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
SirTipsAlot is not online. SirTipsAlot
Joined: 08 Feb 2012
Total Posts: 2431
30 Dec 2016 03:04 PM
well, did it help?


Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Dec 2016 03:04 PM
oh oops

it was equally laggy


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
LilMcManiac is not online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
30 Dec 2016 03:08 PM
are you handling them on the server? or the client? you could handle the calculations for following the player on the client, so it would basically depend on good internet speed.
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Dec 2016 03:09 PM
im handling them on the server

i just have the ai find the nearest torso and follow it


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
LilMcManiac is not online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
30 Dec 2016 03:11 PM
but with a lot of npc's that can get laggy, have the client handle it. Like have the server fire a remoteevent back to the client, asking it to calculate. then have it said it back to the server, and have the server run it. so the client makes the calculations, but the server runs the npc. i think that might help a bit.
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Dec 2016 03:17 PM
"but with a lot of npc's that can get laggy, have the client handle it. Like have the server fire a remoteevent back to the client, asking it to calculate. then have it said it back to the server, and have the server run it. so the client makes the calculations, but the server runs the npc. i think that might help a bit."

i feel like it's still going to lag


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
shadowbloxx123 is not online. shadowbloxx123
Joined: 19 Apr 2016
Total Posts: 37
30 Dec 2016 03:17 PM
.
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
30 Dec 2016 03:21 PM
i've isolated the issue

when i took out the script that deals with the sword being touched there's no lag

how do i optimize that then

script.Parent.Handle.Touched:connect(function(hit)
if hit.Parent~=nil then
if hit.Parent:findFirstChild("Humanoid") then
local h = hit.Parent.Humanoid
if not damage then
damage = true
if a then
h:TakeDamage(math.random(script.Parent.minDmg.Value,script.Parent.maxDmg.Value))
wait(1)
end
damage = false
end

end
end
end)


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image