I am trying to have a force choke move for one of my characters in my game, and I only wanted it to work on certain characters that are within a certain amount of studs from the character.
I tried using a part and welding the part to the player and if the player was touching the part then they would be choked but this brought on more problems then progress.
So does anyone on here know if this is possible? Any tutorials or anything on it out there that I dont know of?
Roblox made magnitude which is very nice for what you're doing http://wiki.roblox.com/index.php?title=Magnitude
But basically something easy would be like
players = game:GetService("Players") hrp0 = players.LocalPlayer.Character.HumanoidRootPart hrp1 = players.Player1.Character.HumanoidRootPart local magnitude = (hrp0.Position - hrp1.Position).magnitude if magnitude < 10 then -- choke player end
You could find out how to get the magnitude right here: http://wiki.roblox.com/index.php?title=Magnitude
When you find that out just use an if statement to check if their magnitude is less then or equal to what you want it to be