Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make a player face where the mouse is pointing?

Asked by
ilel 0
10 years ago

It faces in the same direction every time regardless of where I click.

local player = game.Players.LocalPlayer

script.Parent.Selected:connect(function(mouse)

mouse.Button1Down:connect(function()


b = Instance.new("BodyVelocity")
b.maxForce = Vector3.new(3000,5000,3000)
b.Parent = player.Character.Torso
b.velocity = Vector3.new(0,0,0)

**gyro = Instance.new("BodyGyro")
gyro.maxTorque = Vector3.new(math.huge,math.huge,math.huge)**

**while wait() do**

b.velocity = mouse.Hit.p

**gyro.cframe = mouse.Hit**

**end**
end)
mouse.Button1Up:connect(function()

b:Destroy()

gyro:Destroy()
end)
end)
script.Parent.Deselected:connect(function()

b:Destroy()

end)

1 answer

Log in to vote
0
Answered by
ilel 0
10 years ago

I figured it out thanks

Ad

Answer this question