CFrame rotation setting is wacky for me

So I’m trying to make a contraption that makes it so when the player hits the button, it creates a part in a specific area that kills the player when he touches it. The button and kill script work fine, it’s the part’s rotation that is the issue. It spawns the part in the right place, just not the right rotation.

To fix this, I tried to learn about CFrames. Now when I try to set a rotation, it rotates the part, but I can’t figure out how the rotation numbers work. If I set the rotation to any number, it seems to just make the part rotate to a random spot on whatever axis I set the number on. I tried to set it to 90 degrees, but it rotates it seemingly randomly. I’m not sure what to do. Here is the script.

script.Parent.ClickDetector.MouseClick:Connect(function()
local kill1 = Instance.new ("Part", game.Workspace)
kill1.Parent = game.Workspace
kill1.Position = Vector3.new (835.632, 125.148, -22.286)
kill1.Size = Vector3.new (17.2, 9, 2)
kill1.CanCollide = false
kill1.Anchored = true
kill1.CFrame = CFrame.new(kill1.CFrame.X, kill1.CFrame.Y, kill1.CFrame.Z) * CFrame.Angles(math.rad(0),0,0)
local function onTouched(part)
	local h = part.Parent:findFirstChild("Humanoid")
	if h~=nil then
		h.Health = 0
		wait(2)
	end
end

kill1.Touched:connect(onTouched)

end)

I’m confused on why you’re doing

kill1.CFrame = CFrame.new(kill1.CFrame.X, kill1.CFrame.Y, kill1.CFrame.Z) * CFrame.Angles(math.rad(0),0,0)

instead of just

kill1.CFrame = kill1.CFrame * CFrame.Angles(math.rad(0),0,0)

Can you provide a screenshot of what it looks like without rotation and then setting it to 90 degrees on any angle, with the axis visible?

Your line of code without any angles

withoutcframe

Your line of code with a 90 degree angle

withcframe

I think CFrame:ToWorldSpace() might be the answer to your problems.

Take a look under Relative Rotation.