Advertisement
DrakerMaker

Elements

Jul 1st, 2021
1,086
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.54 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  3. do
  4.     script.Parent = Player.Character
  5.  
  6.     --RemoteEvent for communicating
  7.     local Event = Instance.new("RemoteEvent")
  8.     Event.Name = "UserInput_Event"
  9.  
  10.     --Fake event to make stuff like Mouse.KeyDown work
  11.     local function fakeEvent()
  12.         local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  13.         t.connect = t.Connect
  14.         return t
  15.     end
  16.  
  17.     --Creating fake input objects with fake variables
  18.     local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  19.     local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  20.     local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  21.         CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  22.     end}
  23.     --Merged 2 functions into one by checking amount of arguments
  24.     CAS.UnbindAction = CAS.BindAction
  25.  
  26.     --This function will trigger the events that have been :Connect()'ed
  27.     local function te(self,ev,...)
  28.         local t = m[ev]
  29.         if t and t._fakeEvent and t.Function then
  30.             t.Function(...)
  31.         end
  32.     end
  33.     m.TrigEvent = te
  34.     UIS.TrigEvent = te
  35.  
  36.     Event.OnServerEvent:Connect(function(plr,io)
  37.         if plr~=Player then return end
  38.         if io.isMouse then
  39.             m.Target = io.Target
  40.             m.Hit = io.Hit
  41.         else
  42.             local b = io.UserInputState == Enum.UserInputState.Begin
  43.             if io.UserInputType == Enum.UserInputType.MouseButton1 then
  44.                 return m:TrigEvent(b and "Button1Down" or "Button1Up")
  45.             end
  46.             for _,t in pairs(CAS.Actions) do
  47.                 for _,k in pairs(t.Keys) do
  48.                     if k==io.KeyCode then
  49.                         t.Function(t.Name,io.UserInputState,io)
  50.                     end
  51.                 end
  52.             end
  53.             m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  54.             UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  55.         end
  56.     end)
  57.     Event.Parent = NLS([==[
  58.     local Player = game:GetService("Players").LocalPlayer
  59.     local Event = script:WaitForChild("UserInput_Event")
  60.  
  61.     local UIS = game:GetService("UserInputService")
  62.     local input = function(io,a)
  63.         if a then return end
  64.         --Since InputObject is a client-side instance, we create and pass table instead
  65.         Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  66.     end
  67.     UIS.InputBegan:Connect(input)
  68.     UIS.InputEnded:Connect(input)
  69.  
  70.     local Mouse = Player:GetMouse()
  71.     local h,t
  72.     --Give the server mouse data 30 times every second, but only if the values changed
  73.     --If player is not moving their mouse, client won't fire events
  74.     while wait(1/30) do
  75.         if h~=Mouse.Hit or t~=Mouse.Target then
  76.             h,t=Mouse.Hit,Mouse.Target
  77.             Event:FireServer({isMouse=true,Target=t,Hit=h})
  78.         end
  79.     end]==],Player.Character)
  80.     Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  81. end
  82. function wbtwe(Part0, Part1, C0)
  83. local weld = Instance.new("Weld", Part0)
  84. weld.Part0 = Part0
  85. weld.Part1 = Part1
  86. weld.C0 = Part1.CFrame:inverse() *Part1.CFrame *C0
  87. return weld
  88. end
  89. function setweld(Weld, C0)
  90. Weld.C0 = Weld.Part1.CFrame:inverse() *Weld.Part1.CFrame *C0
  91. end
  92. law = wbtwe(owner.Character["Left Arm"], owner.Character.Torso, CFrame.new(1.49, 0.9, 0) *CFrame.Angles(0, 25, 0.7))
  93. raw = wbtwe(owner.Character["Right Arm"], owner.Character.Torso, CFrame.new(-1.49, 0, 0) *CFrame.Angles(0, 0, 0))
  94. local Fire = Instance.new("Fire")
  95. local Part = Instance.new("Part")
  96. local Position = "betarm"
  97. local Ground = Instance.new("Tool", owner.Backpack)
  98. Ground.Name = "Ground"
  99. local Rock = Instance.new("Tool", owner.Backpack)
  100. Rock.Name = "Rock"
  101. local FireT = Instance.new("Tool", owner.Backpack)
  102. FireT.Name = "Magma"
  103. local Water = Instance.new("Tool", owner.Backpack)
  104. Water.Name = "Water"
  105. local Ice = Instance.new("Tool", owner.Backpack)
  106. Ice.Name = "Ice"
  107. local Air = Instance.new("Tool", owner.Backpack)
  108. Air.Name = "Air"
  109. local Electricity = Instance.new("Tool", owner.Backpack)
  110. Electricity.Name = "Electricity"
  111. local Removal = Instance.new("Tool", owner.Backpack)
  112. Removal.Name = "Removal"
  113. local Music = Instance.new("Sound", owner.Character.Head)
  114. Music.SoundId = "rbxassetid://3045884359"
  115. Music.Volume = 0.5
  116. Music.Looped = true
  117. Music:Play()
  118. local Bass = Instance.new("Sound", owner.Character.Head)
  119. Bass.SoundId = "rbxasset://Sounds/bass.wav"
  120. Bass.Volume = 1
  121. local Active = false
  122. Part.CFrame = CFrame.new(-55.0303,0.71,26.6604,1,0,0,0,1,0,0,0,1)
  123. Part.TopSurface = Enum.SurfaceType.Smooth
  124. Part.Color = Color3.new(0.6235,0.6314,0.6745)
  125. Part.Material = Enum.Material.Glass
  126. Part.CanCollide = false
  127. Part.Size = Vector3.new(1.42,1.42,1.42)
  128. Part.BottomSurface = Enum.SurfaceType.Smooth
  129. Part.Reflectance = 2
  130. Part.Shape = Enum.PartType.Ball
  131. Part.Parent = owner.Character
  132. Fire.Enabled = false
  133. Fire.Size = 4
  134. Fire.Parent = Part
  135. orb = wbtwe(Part, owner.Character.Torso, CFrame.new(1.49, 0.1, 0) *CFrame.Angles(0, 0, -0.1))
  136. spawn(function()
  137. while game:GetService("RunService").Stepped:wait() do
  138. if Position == "betarm" then
  139. setweld(law, CFrame.new(1.49, 0.9, 0) *CFrame.Angles(0, 25, 0.7))
  140. setweld(raw, CFrame.new(-1.49, 0, 0) *CFrame.Angles(0, 0, 0))
  141. setweld(orb, CFrame.new(1.49, 0.1, 0) *CFrame.Angles(0, 0, -0.1))
  142. end
  143. if Position == "magichold" then
  144. setweld(law, CFrame.new(1.49, 0.5, 0) *CFrame.Angles(-0.9, 25, 0.1))
  145. setweld(raw, CFrame.new(-1.49, 0.5, 0) *CFrame.Angles(-0.9, 0, 0))
  146. setweld(orb, CFrame.new(0, 0.4, 1.4) *CFrame.Angles(0, 0, -0.1))
  147. end
  148. if Ground.Parent == owner.Character then
  149. Part.Material = Enum.Material.Grass
  150. Part.BrickColor = BrickColor.new("Bright green")
  151. Part.Reflectance = 0
  152. Position = "betarm"
  153. end
  154. if Water.Parent == owner.Character then
  155. Part.Material = Enum.Material.Glass
  156. Part.BrickColor = BrickColor.new("Deep blue")
  157. Part.Reflectance = 0
  158. Position = "magichold"
  159. end
  160. if Ice.Parent == owner.Character then
  161. Part.Material = Enum.Material.Ice
  162. Part.BrickColor = BrickColor.new("Medium blue")
  163. Part.Reflectance = 0
  164. Position = "betarm"
  165. end
  166. if Rock.Parent == owner.Character then
  167. Part.Material = Enum.Material.Slate
  168. Part.BrickColor = BrickColor.new("Medium stone grey")
  169. Part.Reflectance = 0
  170. Position = "betarm"
  171. end
  172. if Air.Parent == owner.Character then
  173. Part.Material = Enum.Material.Glass
  174. Part.BrickColor = BrickColor.new("Medium stone grey")
  175. Part.Reflectance = 2
  176. Part.Transparency = 0.5
  177. Position = "magichold"
  178. end
  179. if Electricity.Parent == owner.Character then
  180. Part.Material = Enum.Material.Neon
  181. Part.BrickColor = BrickColor.new("Cyan")
  182. Part.Reflectance = 2
  183. Part.Transparency = 0.5
  184. Position = "magichold"
  185. Fire.Enabled = true
  186. end
  187. if Removal.Parent == owner.Character then
  188. Part.Material = Enum.Material.Neon
  189. Part.BrickColor = BrickColor.new("Really red")
  190. Part.Reflectance = 2
  191. Part.Transparency = 0.5
  192. Position = "magichold"
  193. Fire.Enabled = true
  194. end
  195. if FireT.Parent == owner.Character then
  196. Part.Material = Enum.Material.Pebble
  197. Part.BrickColor = BrickColor.new("Smoky grey")
  198. Position = "magichold"
  199. if owner.Character.HumanoidRootPart.Velocity.Magnitude > 1 then
  200. Fire.Enabled = true
  201. else
  202. Fire.Enabled = true
  203. end
  204. else
  205. Fire.Enabled = false
  206. end
  207. if owner.Character:FindFirstChildOfClass("Tool") == nil then
  208. Part.Transparency = 0
  209. Part.Material = Enum.Material.Glass
  210. Part.Reflectance = 2
  211. Part.Color = Color3.new(0.6235,0.6314,0.6745)
  212. Position = "betarm"
  213. else
  214. Part.Transparency = 0
  215. end
  216. end
  217. end)
  218. mouse.Button1Down:connect(function()
  219. Active = true
  220. Bass:Play()
  221. end)
  222. mouse.Button1Up:connect(function()
  223. Active = false
  224. end)
  225. spawn(function()
  226. while game:GetService("RunService").Stepped:wait() do
  227. if Active == true then
  228. if Ground.Parent == owner.Character then
  229. workspace.Terrain:FillBall(mouse.Hit.p, 3, Enum.Material.Grass)
  230. end
  231. if Removal.Parent == owner.Character then
  232. workspace.Terrain:FillBall(mouse.Hit.p, 9, Enum.Material.Air)
  233. end
  234. if Ice.Parent == owner.Character then
  235. workspace.Terrain:FillBall(mouse.Hit.p, 3, Enum.Material.Glacier)
  236. end
  237. if FireT.Parent == owner.Character then
  238. workspace.Terrain:FillBall(mouse.Hit.p, 3, Enum.Material.CrackedLava)
  239. end
  240. if Water.Parent == owner.Character then
  241. workspace.Terrain:FillBall(mouse.Hit.p, 9, Enum.Material.Water)
  242. end
  243. if Rock.Parent == owner.Character then
  244. workspace.Terrain:FillBall(mouse.Hit.p, 3, Enum.Material.Rock)
  245. end
  246. end
  247. end
  248. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement