So I am trying to make a tool aim towards either Mouse.Hit or Mouse.Origin. Right now, I am using Mouse.Hit, but the gun is becoming really glitchy. Why?
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Equipped = false
script.Parent.Equipped:connect(function()
Equipped = true
coroutine.resume(coroutine.create(function()
script.Parent.Parent.Animate.Disabled = true
Mouse.Move:connect(function()
if Equipped == true then
local Angles = Mouse.Hit - Mouse.Hit.p
script.Parent.Parent.Torso["Right Shoulder"].C0 = CFrame.new(script.Parent.Parent.Torso["Right Shoulder"].C0.p, Mouse.Hit.p)
wait()
end
end)
script.Parent.Parent.Animate.Disabled = false
end))
end)
script.Parent.Unequipped:connect(function()
Equipped = false
end)
I feel like this should work, but instead it just flings my arm around. Also, there is no output from the script.

1 comment
The snap C0 is relative, not absolute.