New part instance rotated incorrectly

I’m working on a system to generate killbricks for a game of mine and I have this code here in a modulescript:

tweenService = game:GetService("TweenService")

function attack.genKillBrick(size, cFrame, team, damage, duration, tweens, tweenInfo, endCFrame, addMore, more, debugMode)
	local killBrick = Instance.new("Part")
	killBrick.Anchored = true
	killBrick.Size = size
	killBrick:PivotTo(cFrame)
	print(cFrame)
	print(killBrick.CFrame)
	killBrick.CanCollide = false
	if debugMode then
		killBrick.Color = Color3.new(1, 0.117647, 0.117647)
		killBrick.Transparency = 0.6
	else
		killBrick.Transparency = 1
	end
	killBrick.Name = "killBrick"
	killBrick.Parent = workspace
	-- Makes a killbrick
	local damageVal = Instance.new("IntValue")
	damageVal.Parent = killBrick
	damageVal.Value = damage
	damageVal.Name = "damage"
	-- Makes damage accessible to the damage script
	local teamVal = Instance.new("ObjectValue")
	teamVal.Parent = killBrick
	teamVal.Value = team
	-- Assigns the killbrick to a team to prevent friendly fire
	if addMore then
		local extra = Instance.fromExisting(more)
		extra.Parent = killBrick
	end
	if tweens then
		print("tween goes here haha")
	end
	-- Tweens the part if necessary
	task.wait(duration)
	killBrick:Destroy()
	-- Destroy killbrick after amount of time
end

and this code in another script:

funcs = require(game.ReplicatedStorage.attackMethods)
thing = Vector3.new(600, 20, 600)
funcs.genKillBrick(thing, CFrame.new(Vector3.new(0, 10, 0), Vector3.new(0, 0, 90)), game.Teams["Blue Hive"], 1, 50, 0, 0, 0, false, 0, true)

I would expect this to generate a 600 x 20 x 600 part rotated at 90 degrees on the Z axis, but instead it generates this:


which is NOT AT ALL at the correct angle.
It also prints this as the CFrame:

How do I fix this?

Update: After using part.Position and part.Rotation instead of part.CFrame, it now looks like this with the same position and rotation values:

I’m pretty sure the solution is https://youtu.be/9YqN8_VERps?si=6SR_N7202Ty-niPf
at around 11:30.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.