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: help

Previous Thread :: Next Thread 
TheBlueRivers is not online. TheBlueRivers
Joined: 20 Jul 2011
Total Posts: 2555
01 Jun 2015 08:38 PM

local larm = script.Parent:FindFirstChild("Left Arm")
local rarm = script.Parent:FindFirstChild("Right Arm")

function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
local dist = 1000
local temp = nil
local human = nil
local temp2 = nil
for x = 1, #list do
temp2 = list[x]
if (temp2.className == "Model") and (temp2 ~= script.Parent) then
temp = temp2:findFirstChild("Torso")
human = temp2:findFirstChild("Humanoid")
if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
if (temp.Position - pos).magnitude < dist then
torso = temp
dist = (temp.Position - pos).magnitude
end
end
end
end
return torso
end

function Hit(hit)
local human = hit.Parent:FindFirstChild("Humanoid")
if human ~= nil then
human.Health = human.Health -8
end
end

larm.Touched:connect(Hit)
rarm.Touched:connect(Hit)

while true do
wait(0.1)
local target = findNearestTorso(script.Parent.Torso.Position)
if target ~= nil then
script.Parent.Zombie:MoveTo(target.Position, target)
end
end


and I put them in a person to make em walk. Then I copied the person 5 times and my game lags badly! Does anyone know how to make it not lag?

(yes its a free model script)

(yes im bad at scripting)
Report Abuse
TheBlueRivers is not online. TheBlueRivers
Joined: 20 Jul 2011
Total Posts: 2555
01 Jun 2015 08:39 PM
Ugh the other script I cant post it gives me an error
Report Abuse
TheBlueRivers is not online. TheBlueRivers
Joined: 20 Jul 2011
Total Posts: 2555
01 Jun 2015 09:06 PM
B.U.M.P
Report Abuse
secret6timb1 is not online. secret6timb1
Joined: 11 Sep 2013
Total Posts: 1817
01 Jun 2015 09:08 PM
Side note: Did you copy and paste this? or sections of it?
Report Abuse
TheBlueRivers is not online. TheBlueRivers
Joined: 20 Jul 2011
Total Posts: 2555
01 Jun 2015 09:11 PM
I copied and pasted 1 entire whole script

but i cant paste the other script
Report Abuse
secret6timb1 is not online. secret6timb1
Joined: 11 Sep 2013
Total Posts: 1817
01 Jun 2015 09:13 PM
Give us the error
Report Abuse
TheBlueRivers is not online. TheBlueRivers
Joined: 20 Jul 2011
Total Posts: 2555
01 Jun 2015 09:21 PM
No its just really laggy
Report Abuse
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
01 Jun 2015 09:24 PM
it's bc ur using freemodels and it probs has a virus
Report Abuse
TheBlueRivers is not online. TheBlueRivers
Joined: 20 Jul 2011
Total Posts: 2555
01 Jun 2015 09:48 PM
Well I dont c a virus script thinger in the model
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
01 Jun 2015 10:24 PM
its called using too many loops
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