So, i play a game named The Hunt a lot, its a pretty cool game inspired by isle, and in it theres a customized gun system thats pretty cool, basically when u click on a exact enemy u point a red laser to the enemy,
and after 3 second u shoot a amount of bullets, like 1 for a pistol, 3 for a M4A1 so it isnt op,
and it has short amount of bullets like 36 for M4A1,
And when the enemy goes behind a wall it stops the waiting to shoot and the laser
Can anyone help me doing that?
Here is a little code snippet I made for a gun system like the one you want to create. I recommend putting the ray cast function inside of a module script btw.
if raycastResult then
if raycastResult.Instance.Parent:FindFirstChild("Humanoid") then
raycastResult.Instance.Parent.Humanoid.Health = 0
print(raycastResult.Instance.Parent.Name.." Has been killed!")
end
end
This is just a bare bones if statement for a ray casting gun, and should be treated as an example, not code you should copy and paste into your script, it might not even work because of a few typos, just use it as an example when making your script.