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: killing all humanoids

Previous Thread :: Next Thread 
Alimegacorn is online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
16 Apr 2016 10:01 AM
this script is killing every thing with enemy in it
how do i make it so that it only kills the detected humanoid?
(enemy is humanoid)

local Player = script.Parent.Parent
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()

function FindNearestHumanoidLocation(point)
wait(0.7456)
local points = {}
for _, a in pairs(game.Workspace:GetChildren()) do
if a:IsA("Model") and a:FindFirstChild("Enemy") then
table.insert(points,a:GetModelCFrame().p)
a.Enemy:TakeDamage(100)
end
end



local min = 0
local index = 0

for i=1, #points do
if i==1 then
min = (points[1] - point).magnitude
index = 1
else
local dist = (point - points[i]).magnitude
if dist < min then
min = dist
index = i
end
end
end
return points[index]
end

Mouse.KeyDown:connect(function(Key)
Key = Key:lower()
if Key == "g" then
player.Character:MoveTo(FindNearestHumanoidLocation(player.Character.Torso.Position) + Vector3.new(0,0,2.5))
end
end)
Report Abuse
Salinas23 is not online. Salinas23
Joined: 28 Dec 2008
Total Posts: 37141
16 Apr 2016 10:31 AM
I dont understand the problem.

Is it killing more than it should? Less than it should?


-Salinas con el número 23
Report Abuse
Alimegacorn is online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
16 Apr 2016 01:32 PM
more than it should

sorry for the late reply
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