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

How do I make a HingeConstraint point to the mouse?

Asked by 6 years ago

I'm not very good at CFrame but I'm trying to get it so a HingeConstraint will point to the mouse.

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()

local Part = workspace:WaitForChild("Part")
local Controller = workspace:WaitForChild("Controller")
local Base = workspace:WaitForChild("Base")

while wait() do
    local NewCFrame = CFrame.new(Base.CFrame.p, Mouse.Hit.p):toAxisAngle().Y
    Controller.Horizontal.TargetAngle = NewCFrame * 20
end
0
Please tell us what your problem, how you tried to fix it and any errors you get or we can't help lukeb50 631 — 6y
0
There are no errors. I have tried using the wiki on CFrame for this but it doesn't help too much. Crimson_Foxx 60 — 6y

Answer this question