I am trying to create a tool that rotates when the player clicks, and have found that when I rotate the tool using CFrames, it causes the player to rotate with the tool. I understand this is to due with the character being welded to the tool, but how do I fix this?
Here is my current script:
local tool = script.Parent local main = tool.Handle local m = game.Players.LocalPlayer:GetMouse() local ready = true m.Button1Down:Connect(function() if ready == true then main.CFrame = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.pi,main.Orientation.Y, main.Orientation.Z) else end end)
When moving a tool while maintaining character's cframe, you should change tool grip instead. Example:
local tool = script.Parent local main = tool.Handle local m = game.Players.LocalPlayer:GetMouse() local ready = true m.Button1Down:Connect(function() if ready == true then main.Grip = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.pi,main.Orientation.Y, main.Orientation.Z) else end end)
By the way, it will not replicate to other players.