Advertisement
Nightmaare420

imagine thoooo

Oct 24th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.52 KB | None | 0 0
  1. local DS = game:GetService('DataStoreService')
  2. local SS = game:GetService('ServerStorage')
  3. local tableData = DS:GetDataStore('Stats')
  4. local LS = SS:WaitForChild('LvlStats')
  5.  
  6. local startData = {
  7.     Joe = 0, Yuri = false, Ligma = 'Balls', XP = 0, maxXp = 5000, lvl = 1
  8. }
  9.  
  10. game.Players.PlayerAdded:Connect(function(plr)
  11.     local stFolder = Instance.new('Folder')
  12.     stFolder.Name = "Stats"
  13.     stFolder.Parent = plr
  14.     local Data
  15.     Data = tableData:GetAsync(plr.userId)
  16.     for i,v in pairs(startData) do
  17.     if type(v) == 'number' then
  18.     local Num = Instance.new('IntValue')
  19.         Num.Name = i
  20.         Num.Value = v
  21.         Num.Parent = stFolder
  22.     elseif type(v) == 'boolean' then
  23.         local Bool = Instance.new('BoolValue')
  24.         Bool.Name = i
  25.         Bool.Value = v
  26.         Bool.Parent = stFolder
  27.     elseif type(v) == 'string' then
  28.         local Ito = Instance.new('StringValue')
  29.         Ito.Name = i
  30.         Ito.Value = v
  31.         Ito.Parent = stFolder
  32. end
  33.     end
  34.    
  35.     if Data then
  36.         for i,v in pairs(Data) do
  37.             plr.Stats[i].Value = v
  38.         end
  39.     end
  40.    
  41.     plr.Stats.XP.Changed:Connect(function(plr)
  42.         local XPE = plr.Stats.XP
  43.         local MXPE = plr.Stats.maxXP
  44.         if XPE >= MXPE then
  45.             XPE.Value = XPE.Value - MXPE.Value
  46.             MXPE.Value = MXPE.VALUE * 1.25
  47.             plr.Stats.lvl.Value = plr.Stats.lvl.Value + 1
  48.         end
  49. end)
  50. end)
  51.  
  52. game.Players.PlayerRemoving:Connect(function(plr)
  53.     local Data = {}
  54.     for i,v in pairs(plr.Stats:GetChildren()) do
  55.     Data[v.Name] = v.Value
  56.     end
  57.     tableData:SetAsync(plr.userId, Data)
  58. end)
  59.  
  60. --[[
  61. The
  62. Ultra
  63. Ray
  64. Casting
  65. kid
  66. ]]
  67.  
  68. --// Services \\--
  69. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  70. local TS = game:GetService("TweenService")
  71.  
  72. --// Variables \\--
  73. local Remote = ReplicatedStorage.PikaBeam
  74. local TI = TweenInfo.new(
  75.     0.4,
  76.     Enum.EasingStyle.Linear,
  77.     Enum.EasingDirection.Out,
  78.     0,
  79.     false,
  80.     0
  81. )
  82. local PP = {
  83.     Size = Vector3.new(100,100,100);
  84.     Transparency = 1
  85.     }
  86.  
  87. --// Settings \\--
  88. local Damage = 30
  89.  
  90.  
  91. Remote.OnServerEvent:Connect(function(plr, Mouse)
  92. local Char = plr.Character or plr.CharacterAdded:Wait()
  93.  
  94. local ray = Ray.new(Char.HumanoidRootPart.CFrame.p, (Mouse.p - Char.HumanoidRootPart.CFrame.p).unit * 200)
  95. local part, position = workspace:FindPartOnRay(ray, plr.Character, false, true)
  96. local beam = Instance.new("Part")
  97. beam.BrickColor = BrickColor.new("New Yeller")
  98. beam.FormFactor = "Custom"
  99. beam.Material = "Neon"
  100. beam.Transparency = 0.25
  101. beam.Anchored = true
  102. beam.Locked = true
  103. beam.CanCollide = false
  104. beam.Parent = workspace
  105.  
  106. local distance = (Char.HumanoidRootPart.CFrame.p - position).magnitude
  107. beam.Size = Vector3.new(0.3, 0.3, distance)
  108. beam.CFrame = CFrame.new(Char.HumanoidRootPart.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
  109.  
  110. game:GetService("Debris"):AddItem(beam, 0.1)
  111.  
  112. local Explo = game.ReplicatedStorage.PikaExplosion:Clone()
  113. Explo.Parent = part
  114. Explo.CFrame = CFrame.new(Char.HumanoidRootPart.CFrame.p,position)*CFrame.new(0,0,-distance)
  115.  local Debounce = true
  116. Explo.Touched:Connect(function(h)
  117.   if h.Parent:FindFirstChild('Humanoid') and h.Parent.Name ~= plr.Name and Debounce then
  118.    Debounce = false  
  119.    local Enemy = h.Parent.Humanoid
  120.    Enemy:TakeDamage(Damage)
  121. Damage = 0
  122. wait(0.5)
  123. Damage = 30
  124. end
  125. end)
  126.  
  127. local Tween = TS:Create(Explo,TI,PP)
  128. Tween:Play()
  129. if part then
  130.     local humanoid = part.Parent:FindFirstChild("Humanoid")
  131.            
  132.     if not humanoid then
  133.         humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
  134.     end
  135.            
  136.     if humanoid then
  137.         humanoid:TakeDamage(30)            
  138.       end
  139.     wait(0.5)
  140.     Explo:Destroy()
  141.  end
  142. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement