|
You could use magnitude,
game.Workspace.Part.Position.Magnitude |
|
|
Brick1 = game.Player1.Character.Torso
Brick2 = game.Player.Character.Torso
(Brick1.Position - Brick2.Position).Magnitude |
|
|
Then I would personally suggest building a character and then learning to use the :MoveTo() method as a start. From there, you can learn how to use magnitude and continously improve your methods. |
|
|
Alright, here you go
UsingPlayer = game.Players.LocalPlayer
BombDeb = false
script.Parent.Activated:connect(function()
if not BombDeb then
BombDeb = true
Bomb = Instance.new("Part",Workspace)
Bomb.Shape = "Ball"
Bomb.Parent = game.Workspace
Bomb.BrickColor = BrickColor.Random()
Bomb.Position = UsingPlayer.Character.Torso.Position + Vector3.new(0,-2,2)
wait(3)
for _,v in pairs(game.Workspace:GetChildren()) do
if v.Parent == game.Workspace and v.ClassName == "Part" then
if (v.Position.Magnitude - ... |
|
|
Well, Vector2 would be the 2D vector and Vector3 would be the 3D vector and yes, it does contain position and things such as Magnitude. |
|
|
Actually, I'll explain more in depth.
Vector3, which is the 3D Vector in this sense, encompasses things such as the Position, Rotation, Magnitude, and more.
The Vector3 utilizes the typical "XYZ" axis which you've probably learned about to an extent, so for instance, If I used
Part.Position = Vector3.new(1,2,3)
1 would be the X axis
2 would be the Y axis
3 would be the Z axis
Hopefully this helps you. |
|
|
|
Part = game.Workspace.Part
Sound = Instance.new("Sound")
Sound.SoundId = "http://www.roblox.com/asset/?id=154880454"
while wait() do
for _,v in pairs(game.Players:GetChildren()) do
if (v.Character.Torso.Position.Magnitude - Part.Position.Magnitude)<=-10 then
Sound.Parent = v.PlayerGui
Sound:Play()
end
end
end
Alright, here you go, increase the Magnitude as needed, I apologize for the errors however otherwise it should work well, please feel free to ask if you have anymore questions. |
|
|
|
You could use Magnitude to compare the "Torso" position of both players,
http://wiki.roblox.com/index.php?title=Magnitude |
|
|
You could utilize Magnitude with the Humanoid WalkToPoint property. |
|
|
You could try implementing a debounce with a reasonable wait time to increase the reliability of TouchEnded, if you would rather not do that then you could try using Magnitude, you'll have to make the final decision on your opinion however. |
|
|
You could try experiment with the Magnitude between two part's. An example would be,
Part.Position.Magnitude |
|
|
You could try using Magnitude and KeyDown. |
|
|