Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
|
| 19 Feb 2017 11:22 AM |
LOCAL SCRIPT local RE = game.ReplicatedStorage.NetworkFolder:WaitForChild("RemoteEvent") local tool = script.Parent script.Parent.Equipped:connect(function(mouse) print('Equipped!') local character = script.Parent.Parent mouse.Button1Down:connect(function() RE:FireServer('beam') end) end)
SERVER SCRIPT local RE = game.ReplicatedStorage.NetworkFolder:WaitForChild("RemoteEvent")
RE.OnServerEvent:connect(function(player, request) local tool = player.Character.Tool local character = player.Character local mouse = player:GetMouse() if request == 'beam' then print('Clicked!') local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 300) local part, position = workspace:FindPartOnRay(ray, character, false, true) local beam = Instance.new("Part", workspace) beam.BrickColor = BrickColor.new("Bright blue") beam.FormFactor = "Custom" beam.Material = "Neon" beam.Transparency = 0.25 beam.Anchored = true beam.Locked = true beam.CanCollide = true local distance = (tool.Handle.CFrame.p - position).magnitude beam.Size = Vector3.new(0.3, 0.3, distance) beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0,0, -distance / 2) ga#######################################.2) if part then local humanoid = part.Parent:FindFirstChild("Humanoid") if not humanoid then humanoid = part.Parent.Parent:FindFirstChild("Humanoid") end if humanoid then humanoid:TakeDamage(20) end end end end)
ATR'er since 2013. |
|
|
| Report Abuse |
|
Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
| |