View difference between Paste ID: 4xU1FCL6 and 5fenGLdc
SHOW: | | - or go back to the newest paste.
1
----- Script made by Pedrorb03 -----
2
3
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
4
local Player,Mouse,mouse,UserInputService,ContextActionService = owner
5
local RealPlayer = Player
6
do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end
7
8
9
10
laser = nil
11
laserRot = 0
12
pos2 = Vector3.new(0,0,0)
13
counter = 0
14
function chargeLaser()
15
	local part = Instance.new("Part")  
16
	part.Name = "ChargingLaser"
17
	game:GetService("Debris"):AddItem(part,1) 
18
	part.Parent = game.Players.LocalPlayer.Character
19
	part.BackSurface = Enum.SurfaceType.SmoothNoOutlines
20
	part.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
21
	part.TopSurface = Enum.SurfaceType.SmoothNoOutlines
22
	part.BottomSurface = Enum.SurfaceType.SmoothNoOutlines	
23
	part.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
24
	part.RightSurface = Enum.SurfaceType.SmoothNoOutlines
25
    part.Material = Enum.Material.Neon
26
    part.Anchored = true
27
    part.CanCollide = false
28
    part.Size = Vector3.new(0.5,0.5,0.5)
29
    local light = math.random(50,150)
30
    local rotx = math.random(-360,360)
31
local roty = math.random(-360,360)
32
local rotz = math.random(-360,360)
33
    part.Color = Color3.fromRGB(light,light,light)
34
part.Transparency = 0.4
35
part.CFrame = game.Players.LocalPlayer.Character["Right Arm"].CFrame:toWorldSpace(CFrame.new(Vector3.new(0,-1.1,0))) *CFrame.Angles(math.rad(rotx),math.rad(roty),math.rad(rotz))
36
    for i=0.4,1,0.1 do
37
	wait()
38
	part.Size = Vector3.new(0.5+i,0.5+i,0.5+i)
39
	part.Transparency = i
40
part.CFrame = game.Players.LocalPlayer.Character["Right Arm"].CFrame:toWorldSpace(CFrame.new(Vector3.new(0,-1.1,0))) *CFrame.Angles(math.rad(rotx),math.rad(roty),math.rad(rotz))
41
end
42
part:remove()
43
end
44
function chargeLaser2()
45
	local part = Instance.new("Part") 
46
	game:GetService("Debris"):AddItem(part,1) 
47
	part.Name = "ChargingLaser2"
48
	part.Parent = game.Players.LocalPlayer.Character
49
	part.BackSurface = Enum.SurfaceType.SmoothNoOutlines
50
	part.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
51
	part.TopSurface = Enum.SurfaceType.SmoothNoOutlines
52
	part.BottomSurface = Enum.SurfaceType.SmoothNoOutlines	
53
	part.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
54
	part.RightSurface = Enum.SurfaceType.SmoothNoOutlines
55
    part.Material = Enum.Material.Neon
56
    part.Anchored = true
57
    part.CanCollide = false
58
    part.Size = Vector3.new(2,2,2)
59
    local light = math.random(50,150)
60
    local rotx = math.random(-360,360)
61
local roty = math.random(-360,360)
62
local rotz = math.random(-360,360)
63
    part.Color = Color3.fromRGB(light,light,light)
64
part.Transparency = 0.4
65
part.CFrame = CFrame.new(pos2) *CFrame.Angles(math.rad(rotx),math.rad(roty),math.rad(rotz))
66
    for i=0.4,1,0.1 do
67
	wait()
68
	part.Size = Vector3.new(2+i,2+i,2+i)
69
	part.Transparency = i
70
part.CFrame = CFrame.new(pos2) *CFrame.Angles(math.rad(rotx),math.rad(roty),math.rad(rotz))
71
end
72
part:remove()
73
end
74
75
76
77
78
game:GetService("RunService").RenderStepped:connect(function()
79
	counter = counter +1
80
	if counter >= 3 then
81
		counter = 0
82
		chargeLaser()
83
		if laser ~= nil then
84
			chargeLaser2(pos2)
85
		end
86
	end
87
88
	laserRot = laserRot+1
89
	if laser ~= nil then
90
		local pos1 = game.Players.LocalPlayer.Character.ChargingLaser.Position
91
		pos2 = game.Players.LocalPlayer:GetMouse().Hit.p
92
		
93
		laser.Size = Vector3.new(0.75,0.75,(pos1-pos2).magnitude)
94
		laser.CFrame = CFrame.new((pos1+pos2)/2,pos1)*CFrame.Angles(0,0,math.rad(laserRot))
95
		
96
		local ray = Ray.new(pos1,(pos2-pos1).unit*600)
97
        local hit,position,normal = game.Workspace:FindPartOnRay(ray,game.Players.LocalPlayer.Character)
98
		if hit then
99
		
100
			
101
			hit.Name = "nil"
102
			hit.Material = Enum.Material.Concrete
103
104
			local c= hit.Color.r+hit.Color.g+hit.Color.b
105
			
106
			c = c*255
107
		c = c/3
108
			hit.Color = Color3.fromRGB(c,c,c)
109
			
110
		
111
			for _,child in pairs(hit:GetChildren()) do
112
				if child:IsA("BasePart") then
113
					
114
			
115
					child.Name = "nil"
116
			child.Material = Enum.Material.Concrete
117
				local c= child.Color.r+child.Color.g+child.Color.b
118
		
119
			c = c*255
120
			c = c/3
121
			child.Color = Color3.fromRGB(c,c,c)
122
		
123
				end
124
				if not child:IsA("BasePart") then
125
					child:remove()
126
				end
127
			end
128
		end
129
	end
130
end)
131
game:GetService("UserInputService").InputBegan:connect(function(key)
132
	if key.KeyCode == Enum.KeyCode.F then
133
	game.Players.LocalPlayer.Character.Torso["Right Shoulder"].C0 = game.Players.LocalPlayer.Character.Torso["Right Shoulder"].C0*CFrame.Angles(0,0,math.rad(90))
134
	laser = Instance.new("Part")  
135
	laser.Name = "Laser"
136
	laser.Transparency = 0.25
137
	laser.Parent = game.Players.LocalPlayer.Character
138
	laser.BackSurface = Enum.SurfaceType.SmoothNoOutlines
139
	laser.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
140
	laser.TopSurface = Enum.SurfaceType.SmoothNoOutlines
141
	laser.BottomSurface = Enum.SurfaceType.SmoothNoOutlines	
142
	laser.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
143
	laser.RightSurface = Enum.SurfaceType.SmoothNoOutlines
144
    laser.Material = Enum.Material.Neon
145
    laser.Anchored = true
146
    laser.CanCollide = false
147
    laser.Size = Vector3.new(0.75,0.75,0.75)
148
    laser.Color = Color3.fromRGB(100,100,100)
149
150
	end
151
end)
152
game:GetService("UserInputService").InputEnded:connect(function(key)
153
	if key.KeyCode == Enum.KeyCode.F then
154
	game.Players.LocalPlayer.Character.Torso["Right Shoulder"].C0 = game.Players.LocalPlayer.Character.Torso["Right Shoulder"].C0*CFrame.Angles(0,0,math.rad(-90))
155
	laser:remove()
156
	laser = nil
157
	end
158
end)