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

I made my tool CFrame.Angle equal to mouse delta, and now I just get TPd into the ground?

I just get put into the same location each time I equip the gun!

local RS = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local cam = workspace.CurrentCamera
local tool = script.Parent.Handle

local function onRenderStep()
	local delta = UIS:GetMouseDelta()
	print(delta.y)
	print(delta.x)
	tool.CFrame = CFrame.Angles(math.rad(delta.x),math.rad(delta.y),math.rad(0))
end



RS:BindToRenderStep("measureMovement", Enum.RenderPriority.Input.Value, onRenderStep)

1 answer

✓ Accepted answer

This might be because you're telling it to change the rotation of the CFrame, but not the position. Try this:

tool.CFrame = tool.CFrame.p * CFrame.Angles(math.rad(delta.x),math.rad(delta.y),math.rad(0))

1 comment

0

Thank you!

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