So I need some help to make a gun that when you fire, it pushes you back or up a little.
I got it by detecting if you could see the gun part. Here is the code if anyone wants it!
script.Parent.Activated:Connect(function() local Camera = workspace.Camera local part = workspace.Gunn local _, withinScreenBounds = Camera:WorldToScreenPoint(part.Position)
if withinScreenBounds then local move = Instance.new("BodyVelocity") move.Parent = script.Parent.Parent.HumanoidRootPart move.Name = "Knockback" move.Velocity = Vector3.new(0,50,0) wait(0.5) move:Destroy() end
end)
Closed as Not Constructive by Dovydas1118 and JesseSong
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?