Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ReplicatedStorage = game:GetService('ReplicatedStorage')
- local remoteEvent = ReplicatedStorage:WaitForChild('ShotEvent')
- local ServerStorage = game:GetService('ServerStorage')
- remoteEvent.OnServerEvent:Connect(function(player, gunPos, gunOr, mosPos)
- local bullet = Instance.new('Part')
- bullet.Name = "Bullet"
- bullet.Parent = game.Workspace
- --bullet.Position = gunPos
- bullet.Shape = Enum.PartType.Cylinder
- bullet.Size = Vector3.new(0.5,0.25,0.25)
- bullet.BrickColor = BrickColor.new('Gold')
- local damageScript = ServerStorage:FindFirstChild('Damage'):Clone()
- damageScript.Parent= bullet
- local attacker = Instance.new('StringValue')
- attacker.Name = 'Attacker'
- attacker.Parent = bullet
- attacker.Value = player.Name
- local distance = (mosPos-gunPos).magnitude
- local bulletSpeed = 700
- bullet.CFrame= CFrame.new(gunPos, mosPos )
- bullet.Velocity = bullet.CFrame.LookVector * bulletSpeed
- bullet.Orientation = gunOr + Vector3.new(0,-90,0)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement