I am trying to eject a casing on the server side whenever a gun is fired from the player. The entire script is working fine, but I decided to make the casing a model with a cylinder so it can roll and a sphere on one end so it doesn’t always stand up.
However, suddenly my script just decided to not work and error on me?
-- Assume the casing variable is declared before
local CasingPrim = Casing.PrimaryPart -- declare primary part variable
Casing.Parent = workspace.Debris
--[[Error here]] CasingPrim.CFrame = player.Character:FindFirstChild("CaseExit", true).CFrame * CFrame.Angles(0, math.rad(90), 0)
local offsetcframe = CasingPrim.CFrame + CasingPrim.CFrame.LookVector * offset
CasingPrim:ApplyImpulse(offsetcframe.Position * CasingPrim.AssemblyMass)
Debris:AddItem(Casing, 10)
Observe the primary-part at runtime. You will see that it is not there. Make this observation on the same end of the network that the above code is running on