Advertisement
sriyanto

Untitled

Oct 3rd, 2022
1,170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. local ReplicatedStorage = game:GetService('ReplicatedStorage')
  2. local remoteEvent = ReplicatedStorage:WaitForChild('ShotEvent')
  3. local ServerStorage = game:GetService('ServerStorage')
  4. remoteEvent.OnServerEvent:Connect(function(player, gunPos, gunOr, mosPos)
  5.     local bullet = Instance.new('Part')
  6.     bullet.Name = "Bullet"
  7.     bullet.Parent = game.Workspace
  8.     --bullet.Position = gunPos
  9.     bullet.Shape = Enum.PartType.Cylinder
  10.     bullet.Size = Vector3.new(0.5,0.25,0.25)
  11.     bullet.BrickColor = BrickColor.new('Gold')
  12.     local damageScript = ServerStorage:FindFirstChild('Damage'):Clone()
  13.     damageScript.Parent= bullet
  14.     local attacker = Instance.new('StringValue')
  15.     attacker.Name = 'Attacker'
  16.     attacker.Parent = bullet
  17.     attacker.Value = player.Name
  18.     local distance = (mosPos-gunPos).magnitude
  19.     local bulletSpeed = 700
  20.     bullet.CFrame= CFrame.new(gunPos, mosPos )
  21.     bullet.Velocity = bullet.CFrame.LookVector * bulletSpeed
  22.     bullet.Orientation = gunOr + Vector3.new(0,-90,0)
  23. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement