Advertisement
Firebirdzz

Example

May 6th, 2021
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. -- in this script, i made a fireball. this is a local script, it will fireserver a script in the serverscriptservice.
  2.  
  3. --–//Services\–
  4. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  5. local UserInputService = game:GetService("UserInputService")
  6.  
  7. --– Variables----
  8. local player = game.Players.LocalPlayer
  9. local Character = player.Character or player.CharacterAdded:Wait()
  10. local Remote = ReplicatedStorage.Fire.Fireballevent
  11. local Mouse = player:GetMouse()
  12.  
  13. --–//Settings\–
  14. local Debounce = true
  15. local Key = 'Q'
  16.  
  17. UserInputService.InputBegan:Connect(function(Input , IsTyping)
  18. if IsTyping then return end
  19. local KeyPressed = Input.KeyCode
  20. if KeyPressed == Enum.KeyCode[Key] and Debounce and CUA4 == true and Character then
  21. Debounce = false
  22. Remote:FireServer(Mouse.Hit)
  23. print "Fireserver"
  24. wait(.1)
  25. Debounce = true
  26. end
  27.  
  28. end)
  29.  
  30. -- this is the script in serverscriptservice:
  31.  
  32. --–//Services\–
  33. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  34.  
  35. --– Variables----
  36. local Remote = ReplicatedStorage.Fire.Fireballevent
  37.  
  38. --–//Settings\–
  39. local Damage = 30
  40.  
  41. Remote.OnServerEvent:Connect(function(plr, Mouse)
  42. local Character = plr.Character or plr.CharacterAdded:Wait()
  43.  
  44. local Part = Instance.new("Part")
  45. Part.Shape = Enum.PartType.Ball
  46. Part.Anchored = true
  47. Part.CanCollide = false
  48. Part.Transparency = 0.5
  49. Part.Color = Color3.fromRGB(255,0,0)
  50. Part.Material = Enum.Material.Neon
  51. Part.Size = Vector3.new(3,3,3)
  52. Part.Name = "FireBall"
  53. Part.CFrame = Character.HumanoidRootPart.CFrame *CFrame.new (0,10,0)
  54. Part.Parent = workspace
  55.  
  56. local tweenService = game:GetService("TweenService")
  57.  
  58.  
  59. local tweeningInformation = TweenInfo.new(
  60.  
  61. 3,
  62. Enum.EasingStyle.Linear,
  63. Enum.EasingDirection.Out,
  64. 0,
  65. false,
  66. 0
  67. )
  68.  
  69. local partProperties = {
  70. Size = Vector3.new(10,10,10);
  71. Transparency = math.random(0,1)
  72. }
  73.  
  74.  
  75. local Tween = tweenService:Create(Part, tweeningInformation, partProperties)
  76. Tween:Play()
  77.  
  78. wait(3)
  79.  
  80. Part.Anchored = false
  81.  
  82.  
  83. local BodyVelocity = Instance.new("BodyVelocity")
  84. BodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  85. BodyVelocity.Velocity = Mouse.lookVector*100
  86. BodyVelocity.Parent = Part
  87. local Debounce = true
  88.  
  89. Part.Touched:Connect(function(h)
  90.  
  91. local tweenService = game:GetService("TweenService")
  92.  
  93.  
  94. local tweeningInformation = TweenInfo.new(
  95.  
  96. 1,
  97. Enum.EasingStyle.Linear,
  98. Enum.EasingDirection.Out,
  99. 0,
  100. false,
  101. 0
  102. )
  103.  
  104. local partProperties = {
  105. Size = Vector3.new(50,50,50);
  106. CFrame = h.Parent.HumanoidRootPart.CFrame;
  107. CFrame = h.CFrame;
  108. Transparency = 1
  109. }
  110. BodyVelocity:Destroy()
  111. Part.Anchored = true
  112. Part.CFrame = h.Parent.HumanoidRootPart.CFrame
  113.  
  114. local Tween = tweenService:Create(Part,tweeningInformation,partProperties)
  115. Tween:Play()
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122. end)
  123. end)
  124.  
  125.  
  126. that was the fireball script..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement