What do you want to achieve? Keep it simple and clear!
I’m trying to make a casing eject system for my gun system
What is the issue? Include screenshots / videos if possible!
For some reason, most of the time the part isn’t spawning at the given position, but rather spawning like 50 studs below where it’s supposed to.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried using alternatives like PivotTo, and I looked everywhere on the forum to see if anyone’s having the same issue but it looks like it’s just me.
Here’s my code:
function casingEject()
local casingEject : BasePart = framework.module.casing:Clone()
casingEject.Parent = workspace
casingEject.CFrame = framework.viewmodel.boltPos.CFrame
--game.Debris:AddItem(casingEject,6)
local casingVelocity = Vector3.new(50,20,0)
casingEject.AssemblyLinearVelocity = framework.viewmodel.boltPos.CFrame:VectorToWorldSpace(casingVelocity)
end
and here’s a video of the problem:
nowodev
(Nowoshire)
May 21, 2025, 6:43am
2
Can you show what boltPos
is?
It’s a part in the viewmodel which is supposed to be where the casing spawns in. (also i already checked and its welded correctly)
nowodev
(Nowoshire)
May 21, 2025, 6:50am
4
Try outputting the CFrames, check if they are indeed correct.
I printed both the casing’s CFrame and the boltPos’ CFrame and it outputs the same thing.
nowodev
(Nowoshire)
May 21, 2025, 6:55am
6
Try just spawning them in without applying any velocity, if they’re still not spawning at where you expect them, maybe the casing’s pivot is offset.
I removed the code for the velocity and tried again but it still doesn’t work. I made sure to reset the casing’s pivot in studio, is there a way to reset it within the code or something? Don’t know if it will work though
random solution but I guess you could try to move it up again by 50 studs?
Oh i fixed it already i just forgot to mark this as solved
The viewmodel was unanchored and i was changing its position every frame, which caused the positions to be “falling”
1 Like
system
(system)
Closed
June 4, 2025, 1:50pm
10
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.