Well it can get complex considering what Iām using it to do, so Iāll simplify and show the variables I used.
Server side script:
function fireBullet.OnServerInvoke(player, ID, weapon, start, target, maxD,minD, speed, drop, strength, flash)
coroutine.resume(coroutine.create(function()
projectile(player,ID,weapon, start, target, maxD,minD, speed, drop, strength,flash)
end))
end
----- āprojectile(ā¦)ā spawns the bullet, contains a loop that keeps track of the bullet position, and manages hitscansā¦ ect.
Client side script:
local ID = 1000
local gunType = āAutomaticā
local maxD = 40 āmax damage
local minD = 20 ā min damage
local bulletSpeed = 800
local bulletDrop = 0
local strength = 3 ā wall penetration strength
local flash = true ā muzzle flash on
local startPos = (Tool.Handle.CFrame).p
local endPos = Humanoid.TargetPoint
local spread = 50 ā hipfire spread value
local random = Vector3.new((math.random(-spread, spread) , (math.random(-spread, spread) , (math.random(-spread, spread)
workspace.FireBullet:InvokeServer(ID,gunType, startPos, endPos + random, maxD,minD, bulletSpeed, bulletDrop, strength,flash)