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