View difference between Paste ID: sa4VV4Yy and 4Gcjrs3t
SHOW: | | - or go back to the newest paste.
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
local RealPlayer = Player
4
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()}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;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 t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end,__call=function(self,...)local t=rawget(self,"_RealService")if t then return t(...)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 self[t]end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;x.RunService=v({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")setmetatable(x,{__index=function(self,t)return r:GetService(t)or typeof(r[t])=="function"and function(m,...)return r[t](r,...)end or r[t]end,__newindex=s.__newindex,__call=s.__call})game,owner=x,x.Players.LocalPlayer end
5
6
--Getting the player, character and mouse
7
local plr = game.Players.LocalPlayer
8
local char = plr.Character
9
local Mouse = plr:GetMouse()
10
local mtarget
11
--Making the tool
12
local gun = Instance.new("Tool",plr.Backpack)
13
gun.Name = "weapon"
14
gun.GripPos = Vector3.new(0, -1.315, -0.253)
15
gun.GripUp = Vector3.new(0, -0, 1)
16
local handle = Instance.new("Part",gun)
17
handle.Name = "Handle"
18
handle.Size = Vector3.new(0.3, 4.9, 0.8)
19
local mesh = Instance.new("SpecialMesh",handle)
20
mesh.MeshId = "http://www.roblox.com/asset/?id=42583419"
21
mesh.MeshType = "FileMesh"
22
mesh.Scale = Vector3.new(1.5, 1.5, 1.5)
23
mesh.TextureId = "http://www.roblox.com/asset/?id=42584198"
24
local bullet = Instance.new("Model",gun)
25
bullet.Name = "bullet"
26
local p1 = Instance.new("Part",bullet)
27
p1.Shape = "Ball"
28
p1.Name = "p1"
29
p1.Size = Vector3.new(0.9, 0.9, 0.9)
30
p1.Material = "Neon"
31
p1.BrickColor = BrickColor.new("Really blue")
32
p1.Transparency = 1
33
p1.CanCollide = false
34
p1.BottomSurface = "Smooth"
35
p1.TopSurface = "Smooth"
36
local p2 = Instance.new("Part",bullet)
37
p2.Shape = "Ball"
38
p2.Name = "p2"
39
p2.Size = Vector3.new(1, 1, 1)
40
p2.Material = "Plastic"
41
p2.BrickColor = BrickColor.new("Institutional white")
42
p2.Transparency = 1
43
p2.CanCollide = false
44
p2.BottomSurface = "Smooth"
45
p2.TopSurface = "Smooth"
46
local shoot = Instance.new("Sound",handle)
47
shoot.SoundId = "rbxassetid://2344851316"
48
shoot.Volume = 1
49
local canshoot = false
50
--Making the welds
51
local w1 = Instance.new("Weld",p1)
52
w1.Part0 = p1
53
w1.Part1 = handle
54
w1.C0 = CFrame.new(0, 0, 0, 1, 1.19208686e-07, -2.72848411e-12, 1.19208686e-07, 1, 1.15107923e-12, -2.72848411e-12, 1.15107923e-12, 1)
55
w1.C1 = CFrame.new(-0.0999778807, 3.69987226, 0.299981654, 1, 1.19208686e-07, -2.72848411e-12, 1.19208686e-07, 1, 1.15107923e-12, -2.72848411e-12, 1.15107923e-12, 1)
56
w1.Name = "hWeld"
57
local w2 = Instance.new("Weld",p1)
58
w2.Part0 = p1
59
w2.Part1 = p2
60
w2.C0 = CFrame.new(0.299996376, -5.29999924, 1.5, 0.999998569, 5.96042923e-07, -1.36423997e-11, 5.96043094e-07, 1, 5.75538922e-12, -1.36423997e-11, 5.75538749e-12, 0.999998569)
61
w2.C1 = CFrame.new(0.300022125, -5.30012798, 1.49998176, 1, 1.19208686e-07, -2.72848411e-12, 1.19208686e-07, 1, 1.15107923e-12, -2.72848411e-12, 1.15107923e-12, 1)
62
--Functions
63
gun.Equipped:connect(function()
64
	local weld = Instance.new("Weld",char)
65
	weld.Name = "Weld"
66
	weld.Part0 = char.Torso
67
	weld.Part1 = char["Left Arm"]
68
	weld.C1 = CFrame.new(0.199999988, 0.699999988, 0, 0.642787516, 7.6651645e-09, -0.766044438, 0.766044438, 9.13498788e-09, 0.642787516, 1.19248806e-08, -0.99999994, -5.21253064e-16)
69
	weld.C0 = CFrame.new(-1, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
70
	local weld2 = Instance.new("Weld",char)
71
	weld2.Part0 = char.Torso
72
	weld2.Part1 = char["Right Arm"]
73
	weld2.C1 =  CFrame.new(0, 0.49999997, 0, -4.37113847e-08, 0, 0.99999994, -1, -4.37113847e-08, -4.37113883e-08, 4.37113883e-08, -0.99999994, 1.91068547e-15)
74
	weld2.C0 = CFrame.new(1, 0.5, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
75
	weld2.Name = "Weld2"
76
	canshoot = true
77
end)
78
79
gun.Unequipped:connect(function()
80
	char.Weld:Destroy()
81
	char.Weld2:Destroy()
82
	canshoot = false
83
end)
84
85
86
    function clickObj()
87
if canshoot == true then
88
	mtarget = Mouse.Target
89
	if mtarget then
90
		shoot:Play()
91
	local bulc = bullet:Clone()
92
	bulc.Parent = game.Workspace
93
	bulc.p1.Transparency = 0.5
94
	bulc.p2.Transparency = 0.5
95
	bulc.p1.hWeld:Destroy()
96
	bulc.p2.CanCollide = true
97
	local bv = Instance.new("BodyVelocity")
98
bv.Parent = bulc.p2
99
bv.velocity = ((char.Humanoid.TargetPoint - bulc.p2.Position).unit) * 50
100
101
function onTouched(brick)
102
	local humn = brick.Parent:FindFirstChildOfClass("Humanoid")
103
	if humn then
104
		if humn.Parent ~= char then
105
			if humn.Name ~= "killed" then
106
			local par = humn.Parent
107
108
	for i,v in pairs(par:GetChildren()) do
109
		if v.ClassName == "Script" or v.ClassName == "LocalScript" or v.ClassName == "ModuleScript" or v.ClassName == "CharacterMesh" then
110
			v:Destroy()
111
		end
112
	end
113
114
par.Torso["Right Hip"].Part1 = nil
115
par.Torso["Left Hip"].Part1 = nil
116
par.Torso["Right Shoulder"].Part1 = nil
117
par.Torso["Left Shoulder"].Part1 = nil
118
119
                        for i,v in pairs(par:GetChildren()) do
120
            if v.ClassName == "Part" then
121
	v.BrickColor = BrickColor.new("Institutional white")
122
	v.Material = "Neon"
123
    if v.Name == "limb" then
124
    v:Destroy()
125
end
126
end
127
end
128
129
                        for i,v in pairs(par.Head:GetChildren()) do
130
            if v.ClassName == "Decal" then
131
    v:Destroy()
132
end
133
end
134
135
                        for i,v in pairs(par.Head:GetChildren()) do
136
            if v.ClassName == "Part" then
137
    v.Anchored = false
138
end
139
end
140
141
                        for i,v in pairs(par:GetChildren()) do
142
            if v.ClassName == "Hat" or v.ClassName == "Accessory" then
143
	v.Handle.BrickColor = BrickColor.new("Institutional white")
144
	v.Handle.Material = "Neon"
145
    for i,v in pairs(v.Handle:GetChildren()) do
146
	if v.ClassName == "SpecialMesh" then
147
		v.TextureId = ""
148
	end
149
end
150
end
151
end
152
153
humn.Name = "killed"
154
155
local bp = Instance.new("BodyPosition",par["Right Arm"])
156
bp.Position = par["Right Arm"].Position
157
bp.Position = bp.Position + Vector3.new(0,8,0)
158
159
local bp = Instance.new("BodyPosition",par["Left Leg"])
160
bp.Position = par["Left Leg"].Position
161
bp.Position = bp.Position + Vector3.new(0,4,0)
162
163
local bp = Instance.new("BodyPosition",par.Torso)
164
bp.Position = par.Torso.Position
165
bp.Position = bp.Position + Vector3.new(0,2,0)
166
167
local bp = Instance.new("BodyPosition",par["Left Arm"])
168
bp.Position = par["Left Arm"].Position
169
bp.Position = bp.Position + Vector3.new(0,2,0)
170
171
local bp = Instance.new("BodyPosition",par["Right Leg"])
172
bp.Position = par["Right Leg"].Position
173
bp.Position = bp.Position + Vector3.new(0,2,0)
174
175
local rac = Instance.new("Part",par)
176
rac.Size = Vector3.new(1,1,1)
177
rac.Position = par["Right Arm"].Position
178
rac.Name = "limb"
179
rac.Transparency = 1
180
local w = Instance.new("Weld",rac)
181
w.Part0 = par["Right Arm"]
182
w.Part1 = rac
183
w.C0 = CFrame.new(0,-0.5,0)
184
 
185
local lac = Instance.new("Part",par)
186
lac.Size = Vector3.new(1,1,1)
187
lac.Position = par["Left Arm"].Position
188
lac.Name = "limb"
189
lac.Transparency = 1
190
local w = Instance.new("Weld",lac)
191
w.Part0 = par["Left Arm"]
192
w.Part1 = lac
193
w.C0 = CFrame.new(0,-0.5,0)
194
 
195
local rlc = Instance.new("Part",par)
196
rlc.Size = Vector3.new(1,1,1)
197
rlc.Position = par["Right Leg"].Position
198
rlc.Name = "limb"
199
rlc.Transparency = 1
200
local w = Instance.new("Weld",rlc)
201
w.Part0 = par["Right Leg"]
202
w.Part1 = rlc
203
w.C0 = CFrame.new(0,-0.5,0)
204
 
205
local llc = Instance.new("Part",par)
206
llc.Size = Vector3.new(1,1,1)
207
llc.Position = par["Right Leg"].Position
208
llc.Name = "limb"
209
llc.Transparency = 1
210
local w = Instance.new("Weld",llc)
211
w.Part0 = par["Left Leg"]
212
w.Part1 = llc
213
w.C0 = CFrame.new(0,-0.5,0)
214
 
215
            local Joint = Instance.new("Glue")
216
            Joint.Name = "RightShoulder"
217
            Joint.Part0 = par.Torso
218
            Joint.Part1 = par["Right Arm"]
219
            Joint.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
220
            Joint.C1 = CFrame.new(-0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
221
            Joint.Parent = par.Torso
222
 
223
            local Joint = Instance.new("Glue")
224
            Joint.Name = "LeftShoulder"
225
            Joint.Part0 = par.Torso
226
            Joint.Part1 = par["Left Arm"]
227
            Joint.C0 = CFrame.new(-1.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
228
            Joint.C1 = CFrame.new(0, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
229
            Joint.Parent = par.Torso
230
           
231
            local Joint = Instance.new("Glue")
232
            Joint.Name = "RightHip"
233
            Joint.Part0 = par.Torso
234
            Joint.Part1 = par["Right Leg"]
235
            Joint.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
236
            Joint.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
237
            Joint.Parent = par.Torso
238
 
239
            local Joint = Instance.new("Glue")
240
            Joint.Name = "LeftHip"
241
            Joint.Part0 = par.Torso
242
            Joint.Part1 = par["Left Leg"]
243
            Joint.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
244
            Joint.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
245
            Joint.Parent = par.Torso
246
 
247
humn.PlatformStand = true
248
wait(4.5)
249
                        for i,v in pairs(par:GetChildren()) do
250
            if v.ClassName == "Part" then
251
	local w1 = Instance.new("WedgePart",workspace)
252
	w1.Size = Vector3.new(0.5,0.5,0.5)
253
	w1.Position = v.Position
254
	w1.Material = "Neon"
255
	local w2 = Instance.new("WedgePart",workspace)
256
	w2.Size = Vector3.new(0.5,0.5,0.5)
257
	w2.Position = v.Position
258
	w2.Material = "Neon"
259
    v:Destroy()
260
end
261
end
262
		end
263
		bulc:Destroy()
264
	end
265
	end
266
	end
267
bulc.p2.Touched:connect(onTouched)
268
	end
269
	end
270
end
271
Mouse.Button1Down:connect(clickObj)