|
| 19 May 2013 12:04 PM |
Im trying to make a roll away script (by slightly editing a chroma egg of speeding bullets script) and i dont know what to do from here on. In the chroma,if the player was in its range the script would change the eggs velocity to 44,0,0,but i dont want it to do that. i want it to use a body force to roll away from any direction. and my inability to script as well as other people do,has gotten me stuck. this is what the scirpt looks like: function findNearestTorso(pos) local list = game.Workspace:children() local torso = nil local dist = 15 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
while true do wait(0.1) local target = findNearestTorso(script.Parent.Position) if target ~= nil then script.Parent.BodyForce.force = end end
Really,im only editing line 28,but i dont know what to do now,could i use some help? |
|
|
| Report Abuse |
|