Advertisement
jersito4

FixedScript-AnimeUniverse

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