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

how do i make a part face towards the mouse?

Asked by 5 years ago
script.Parent.Activated:Connect(function()
    local plr = game.Players.LocalPlayer
    local mouse = plr:GetMouse()
    local char = plr.Character
    local waited = char:FindFirstChild("asdsd")
local x = Instance.new("BodyVelocity",waited)
waited.Anchored = false
x.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
x.Velocity = mouse.Hit.LookVector * 23
waited.Orientation = mouse.Hit.LookVector.Orientation
wait(2)
waited:Destroy()
end)

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
script.Parent.Activated:Connect(function()
    local plr = game.Players.LocalPlayer
    local mouse = plr:GetMouse()
    local char = plr.Character
    local waited = char:FindFirstChild("asdsd")
    local x = Instance.new("BodyVelocity",waited)
    waited.Anchored = false
    x.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
    x.Velocity = mouse.Hit.LookVector * 23
    waited.CFrame = CFrame.new(waited.Position, mouse.Hit.Position) -- <<<<
    wait(2)
    waited:Destroy()
end)
Ad

Answer this question