Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script.Parent.shot.OnServerEvent:Connect(function(player, mp2)
- local MaxDistance = math.huge -- Maximum distance the ray can go
- script.Parent.Handle.pow:Play()
- script.Parent.Handle.Flare.ParticleEmitter:Emit(100)
- local dist = (script.Parent.Handle.Flare.WorldPosition - mp2)
- local raycastparams = RaycastParams.new()
- local direction = (mp2 - script.Parent.Handle.Flare.WorldPosition).Unit * 999999999999999999
- local direction2 = (mp2 - script.Parent.Handle.Flare.WorldPosition).Unit
- raycastparams.FilterDescendantsInstances = script.Parent.Parent:GetDescendants()
- raycastparams.FilterType = Enum.RaycastFilterType.Blacklist
- local raycast = workspace:Raycast(script.Parent.Handle.Flare.WorldPosition, direction, raycastparams)
- local part = Instance.new("Part", script.Parent)
- part.Anchored = true
- game.Debris:AddItem(part, .02)
- part.CanCollide = false
- part.CanTouch = false
- part.CanQuery = false
- part.Size = Vector3.new(.001, .001, .001)
- part.Transparency = 1
- local att = Instance.new("Attachment", part)
- if raycast then
- if raycast.Instance.Parent:FindFirstChildOfClass("Humanoid") then
- raycast.Instance.Parent:FindFirstChildOfClass("Humanoid").Health -= math.random(10, 15)
- end
- part.Position = raycast.Position
- script.Parent.Handle.Beam.Attachment1 = att
- else
- part.Position = script.Parent.Handle.Flare.WorldPosition + direction2 * 2000
- script.Parent.Handle.Beam.Attachment1 = att
- end
- end)
Add Comment
Please, Sign In to add comment