I’m making an ability where you press E to create a box at the mouse cursor. It spawns in the right position, but it’s always rotated in a weird manner and the camera angle seems to be affecting that.
I’ve tried PivotTo: and SetPrimaryPartCFrame: but the rotation is still there. How can I make it so that it spawns with the original rotation of the model instead of being weirdly rotated?
local rs = game:GetService("ReplicatedStorage")
script.Parent.TrapPlaceEvent.OnServerEvent:Connect(function(player,mouse,mousecframe,mousepos)
local trap = rs.illuminatrap:Clone()
trap.Parent = workspace
trap:SetPrimaryPartCFrame(mousepos)
trap:WaitForChild("primary"):Destroy()
local children = trap:GetChildren()
for i = 1, #children do
wait(0.025)
children[i].Transparency = 0.9
wait(0.025)
children[i].Transparency = 0.8
wait(0.025)
children[i].Transparency = 0.7
wait(0.025)
children[i].Transparency = 0.6
wait(0.025)
children[i].Transparency = 0.5
wait(0.025)
children[i].Transparency = 0.4
wait(0.025)
children[i].Transparency = 0.3
wait(0.025)
children[i].Transparency = 0.2
wait(0.025)
children[i].Transparency = 0.1
wait(0.025)
children[i].Transparency = 0
end
end)