Im trying to make it go to the mouse but i cannot get it to work!
local ViewportFrame = script.Parent.Frame.ViewportFrame
local Part = ViewportFrame.WorldModel.Union
local Mouse = game.Players.LocalPlayer:GetMouse()
local Camera = game.Workspace.CurrentCamera
local PivotOffset = Vector3.new(0.81, 0.255, 0)
local Pivot = CFrame.new(Part.Position) * CFrame.new(PivotOffset) * Part.CFrame
local function rot()
local axis = Vector3.new(0, Mouse.Hit.y, 0)
local rotation = CFrame.fromAxisAngle(axis, math.rad(5))
Part.CFrame = Part.CFrame * CFrame.new(PivotOffset) * rotation * CFrame.new(-PivotOffset)
end
Mouse.Move:Connect(rot)
local ViewportFrame = script.Parent.Frame.ViewportFrame
local Part = ViewportFrame.WorldModel.Union
local Mouse = game.Players.LocalPlayer:GetMouse()
local Camera = game.Workspace.CurrentCamera
local PivotOffset = Vector3.new(0, 0, 0)
local Pivot = CFrame.new(Part.Position) * CFrame.new(PivotOffset) * Part.CFrame
local function rot()
local axis = Vector3.new(0, Mouse.Hit.y, 0)
local rotation = CFrame.fromAxisAngle(axis, math.rad(5))
Part.CFrame = Part.CFrame * CFrame.new(PivotOffset) * rotation * CFrame.new(-PivotOffset)
end
Mouse.Move:Connect(rot)