Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Character rotating with tool. How to fix this?

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)

1 answer

✓ Accepted answer

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.

1 comment

0

I figured that, would I be able to solve this with a Remote Function?

This discussion is preserved as it was. New answers, comments, and votes are closed.