User:Kaze: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Kaze
>Kaze
 
Line 39: Line 39:
</pre>
</pre>
This script will basically keep checking the distance of nearby players, and go to them if it's in range.
This script will basically keep checking the distance of nearby players, and go to them if it's in range.
*The brick that this script is in '''MUST''' have a BodyPosition in it named "bp" to work.
*The brick that this script is in '''MUST''' have a BodyPosition in it to work.

Latest revision as of 01:40, 26 June 2008

Intro

Wassup? I'm Kaze, and I've been playing ROBLOX for about a year and some. I joined May 8th, 2007. This is my user page, and I'll pretty much post all the goodies I come up with!

Scripts

I'm an intermediate scripter, and a pro-builder. Although not many of my creations make it to the Games list, (Mainly because of all them EBIL noobs out there.) I make great things. Then I save it to my C-Drive and hide it away until I want to use it again. Which is usually never, but whatevah!.

So far, I've come up with small, simple scripts. I will soon make a save script. Or at least attempt it. Check in soon! --Kaze 14:51, 3 June 2008 (CDT)


The Close Proximity script

This was made by JustinP231, he helped me on it.

while true do 
	wait()
	local MaxDist = 5
	local Dist = 5
	local BestDist = 5
	local Target = nil
	local X = script.Parent.Position.x
	local Y = script.Parent.Position.y
	local Z = script.Parent.Position.z
	local W = game.Workspace:GetChildren()
	for i = 1, #W do
		if W[i]:findFirstChild("Torso") ~= nil and W[i]:findFirstChild("Humanoid") ~= nil then
			local X2 = math.abs(X - W[i].Torso.Position.x)
			local Y2 = math.abs(Y - W[i].Torso.Position.y)
			local Z2 = math.abs(Z - W[i].Torso.Position.z)
			if (X2 + Y2 + Z2) < MaxDist and (X2 + Y2 + Z2) < BestDist then
				Target = W[i].Torso
				BestDist = (X2 + Y2 + Z2)
			end 
		end 
	end
	if Target ~= nil then
		script.Parent.BodyPosition.position = Target.Position
	end
end 

This script will basically keep checking the distance of nearby players, and go to them if it's in range.

  • The brick that this script is in MUST have a BodyPosition in it to work.