-
What do you want to achieve? Working shell drop system
-
What is the issue? https://youtu.be/t8xNjuH3D48
-
What solutions have you tried so far? I tried to find solutions on other dev forums
Hello, I need to make shell drop system, but my shells dont drop sometimes, how can I fix it?
function shell()
local attachment = currentGun.Receiver:FindFirstChild("Attachment")
local part = Instance.new("Part")
part.Parent = workspace
part.Size = Vector3.new(0.2,0.2,0.2)
part.Material = Enum.Material.Neon
part.AssemblyLinearVelocity = Vector3.new(part.CFrame.LookVector * 30) + (part.CFrame.RightVector * 10) + Vector3.new(0,20,0)
part.CFrame = attachment.WorldCFrame
debris:AddItem(part, 10)
end
1 Like
Im still here and need help with it
1 Like
Try setting the CFrame before the AssemblyLinearVelocity, like so:
function shell()
local attachment = currentGun.Receiver:FindFirstChild("Attachment")
local part = Instance.new("Part")
part.Parent = workspace
part.Size = Vector3.new(0.2,0.2,0.2)
part.Material = Enum.Material.Neon
part.CFrame = attachment.WorldCFrame
part.AssemblyLinearVelocity = Vector3.new(part.CFrame.LookVector * 30) + (part.CFrame.RightVector * 10) + Vector3.new(0,20,0)
debris:AddItem(part, 10)
end
If it doesn’t work, you can try changing the positions of the attachments where the shells are dropping incorrectly
1 Like
It didn’t help, for unknown reasons the part sometimes doesn’t even appear where it’s needed
1 Like
See if doing this works:
function shell()
local attachment = currentGun.Receiver:FindFirstChild("Attachment")
local part = Instance.new("Part")
part.Size = Vector3.new(0.2, 0.2, 0.2)
part.Material = Enum.Material.Neon
part.CFrame = attachment.WorldCFrame
part.AssemblyLinearVelocity = Vector3.new(10, 20, -30)
part.Parent = workspace
debris:AddItem(part, 10)
end
Still same problem, now its just fall down
ApplyImpulse might work closer to what you’d wish:
function shell()
local attachment = currentGun.Receiver:FindFirstChild("Attachment")
local part = Instance.new("Part")
part.Size = Vector3.new(0.2, 0.2, 0.2)
part.Material = Enum.Material.Neon
part.CFrame = attachment.WorldCFrame
part.Parent = workspace
part:ApplyImpulse(Vector3.new(10, 20, -30) * part.Mass)
debris:AddItem(part, 10)
end
It’s really better, but sometimes the details that they are disappear or appear where they shouldn’t be
Using part.CFrame:PointToWorldSpace
should fix that problem:
function shell()
local attachment = currentGun.Receiver:FindFirstChild("Attachment")
local part = Instance.new("Part")
part.Size = Vector3.new(0.2, 0.2, 0.2)
part.Material = Enum.Material.Neon
part.CFrame = attachment.WorldCFrame
part.Parent = workspace
part:ApplyImpulse(part.CFrame:PointToWorldSpace(Vector3.new(10, 20, -30)) * part.Mass)
debris:AddItem(part, 10)
end
1 Like
Thats really good, thank you so much for helping!
1 Like
system
(system)
Closed
#11
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.