Advertisement
Guest User

Error

a guest
Aug 18th, 2019
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. --//Server Script
  2. local UIS = game:GetService("UserInputService")
  3. local mouse = game.Players.LocalPlayer:GetMouse()
  4. local debounce = false
  5.  
  6. --PC
  7. UIS.InputBegan:Connect(function(key, processed)
  8. if processed or debounce then return end
  9. debounce = true
  10.  
  11. if key.UserInputType == Enum.UserInputType.Keyboard then
  12. if key.KeyCode == Enum.KeyCode.Z then
  13. game.ReplicatedStorage.Events.NegativeVortex:FireServer(mouse.Hit.Position)
  14. end
  15. end
  16. wait(1)
  17. debounce = false
  18. end)
  19.  
  20. --Mobile
  21. if UIS.TouchEnabled then
  22. UIS.TouchTap:Connect(function(position, processed)
  23. if processed or debounce then return end
  24. debounce = true
  25.  
  26. game.ReplicatedStorage.Events.NegativeVortex:FireServer(mouse.Hit.Position)
  27. wait(1)
  28. debounce = false
  29. end)
  30. end
  31.  
  32. --//Local Script
  33. game.ReplicatedStorage.Events.NegativeVortex.OnServerEvent:Connect(function(player, mousePos)
  34. local effects = game.ReplicatedStorage.EffectsVortex
  35. local vortex = effects.NegativeVortex:Clone()
  36. local explosion = effects.Explosion:Clone()
  37. local character = player.Character
  38.  
  39. --Fireball
  40. vortex.Position = character.HumanoidRootPart.Position
  41. vortex.Parent = workspace
  42. local velocity = Instance.new("BodyVelocity", vortex)
  43. velocity.Velocity = CFrame.new(vortex.Position, mousePos).LookVector * 50
  44.  
  45. --Explosion
  46. vortex.Touched:Connect(function(hit)
  47. if hit:IsDescendantOf(character) or hit:FindFirstChild("ParticleEmitter") then return end
  48. explosion.Position = vortex.Position
  49. :Destroy()
  50. explosion.Parent = workspace
  51.  
  52. if hit.Parent:FindFirstChild("Humanoid") then
  53. hit.Parent:FindFirstChild("Humanoid"):TakeDamage(20)
  54. end
  55.  
  56. wait(1)
  57. explosion:Destroy()
  58. end)
  59. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement