@robloxchickenrocket @BJCarpenter
I’ve tried out using the codes that you have provided, is this the intended effect of the code? I was thinking that the player should stop exactly when magnitude is reached.
Here’s the script:
wait(2)
local Part = script.Parent
local Players = game:GetService("Players"):GetChildren()
local Enabled = false
for i,v in pairs(Players) do
local character = v.Character or v.CharacterAdded:Wait()
local HumanoidRootPart = character.HumanoidRootPart
while true do
wait()
local Magnitude = (Vector3.new(Part.Position.X,0,Part.Position.Z) - Vector3.new(HumanoidRootPart.Position.X,0,HumanoidRootPart.Position.Z)).magnitude
if Magnitude < 6.5 and Magnitude > 6 and not Enabled then
Enabled = true
local Direction = Part.Position - character.HumanoidRootPart.Position
Direction = Direction.unit * 6.5
character.HumanoidRootPart.CFrame = CFrame.new(Part.Position - Direction)
character.HumanoidRootPart.Velocity = Vector3.new(0,0,0)
character.Humanoid.WalkSpeed = 0
end
end
end