Tool:WaitForChild("Create").OnServerEvent:Connect(function(player, bulletPos) local Bullet = Instance.new('Part', workspace) Bullet.FormFactor = Enum.FormFactor.Custom Bullet.Size = Vector3.new(0.1, 0.1, 0.1) Bullet.BrickColor = BrickColor.new("Black") Bullet.Shape = Enum.PartType.Block Bullet.CanCollide = false Bullet.CFrame = CFrame.new(bulletPos) Bullet.Anchored = true Bullet.TopSurface = Enum.SurfaceType.Smooth Bullet.BottomSurface = Enum.SurfaceType.Smooth Bullet.Name = 'Bullet' game.Debris:AddItem(Bullet, 3) local Ricochet = Instance.new("Sound") Ricochet.SoundId = "rbxassetid://259586543" Ricochet.Parent = Bullet Ricochet.Volume = 10 Ricochet:Play() Ricochet.Volume = 2 Ricochet.MaxDistance = 15 Ricochet.EmitterSize = 15 Ricochet.Pitch = 1 * math.random(38, 42)/40
local configs = script.Parent:WaitForChild("Configurations")
local fr = configs:FindFirstChild("FireRate")
local maxD = configs:FindFirstChild("MaxDmg")
local minD = configs:FindFirstChild("MinDmg")
local vel = configs:FindFirstChild("Velocity")
local acc = configs:FindFirstChild("Accuracy")
local proj = Instance.new("Part", workspace)
proj.Name = "Paintball"
proj.BrickColor = BrickColor.Random()
proj.Shape = "Ball"
proj.Material = Enum.Material.SmoothPlastic
proj.TopSurface = 0
proj.BottomSurface = 0
proj.Size = Vector3.new(0.5, 0.5, 0.5)
proj.Transparency = 0
proj.CanCollide = false
local att0 = Instance.new("Attachment", proj)
att0.Position = Vector3.new(0.25, 0, 0)
att0.Name = "Attach0"
local att1 = Instance.new("Attachment", proj)
att1.Position = Vector3.new(-0.25, 0, 0)
att1.Name = "Attach1"
local transparencyPoints = {}
local startColor = proj.BrickColor.Color
local endColor = proj.BrickColor.Color
table.insert(transparencyPoints, NumberSequenceKeypoint.new(0, 1))
table.insert(transparencyPoints, NumberSequenceKeypoint.new(0.25, 0))
table.insert(transparencyPoints, NumberSequenceKeypoint.new(1, 1))
local determinedTransparency = NumberSequence.new(transparencyPoints)
local determinedColors = ColorSequence.new(startColor, endColor)
local trail = Instance.new("Trail", proj)
trail.FaceCamera = true
trail.Lifetime = 0.25
trail.MinLength = 0.1
trail.Attachment0 = att0
trail.Attachment1 = att1
trail.LightEmission = 0.5
trail.Transparency = determinedTransparency
trail.Color = determinedColors
proj.CFrame = Flash.CFrame
proj.Velocity = (CFrame.new(bulletPos).lookVector * vel.Value) + Vector3.new(math.random(-acc.Value, acc.Value), math.random(-acc.Value, acc.Value), math.random(-acc.Value, acc.Value))
game.Debris:AddItem(proj, 20)
end)
