I’ve been making a grenade and I need it to to project. I’m not sure how I would do this but I think I need to use BodyMovers.
I don’t want raycasts but instead a “prefab” type of projectile.
Thanks for viewing this!
I’ve been making a grenade and I need it to to project. I’m not sure how I would do this but I think I need to use BodyMovers.
I don’t want raycasts but instead a “prefab” type of projectile.
Thanks for viewing this!
Probably not bodymovers; something more like bodyforces or something that applies actual thrust to the grenade would suit you better and be more accurate. I don't know what you mean by 'prefab', but this is probably the way to go.
For example; if you wanted to throw the grenade where your mouse is pointed, your code would probably be something like this:
tool.Activated:Connect(function()
local grenadeClone = fakeGrenade:Clone() -- fake grenade is probably the actual body of the grenade somewhere else like in replicatedstorage maybe (you could probably copy the handle of the tool)
local bodyForce = Instance.new("BodyForce")
grenadeClone:SetPrimaryPartCFrame(tool.Handle.CFrame)
tool:Destroy()
grenadeClone.Parent = workspace
bodyForce.Force = playerHumanoid.TargetPoint.Unit * 100
bodyForce.Parent = grenadeClone
end)
Remember: this is a rough draft; and probably won't work. Experiment.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Thank you, but how would I apply a body force to my grenade?
Updated answer ^^