View difference between Paste ID: ak7pURPK and bNtLbA11
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,game,owner = owner,game
4
local RealPlayer = Player
5
do
6
	print("FE Compatibility code V2 by Mokiros")
7
	local RealPlayer = RealPlayer
8
	script.Parent = RealPlayer.Character
9
10
	--Fake event to make stuff like Mouse.KeyDown work
11
	local Disconnect_Function = function(this)
12
		this[1].Functions[this[2]] = nil
13
	end
14
	local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
15
	local FakeEvent_Metatable = {__index={
16
		Connect = function(this,f)
17
			local i = tostring(math.random(0,10000))
18
			while this.Functions[i] do
19
				i = tostring(math.random(0,10000))
20
			end
21
			this.Functions[i] = f
22
			return setmetatable({this,i},Disconnect_Metatable)
23
		end
24
	}}
25
	FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
26
	local function fakeEvent()
27
		return setmetatable({Functions={}},FakeEvent_Metatable)
28
	end
29
30
	--Creating fake input objects with fake variables
31
    local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
32
    FakeMouse.keyUp = FakeMouse.KeyUp
33
    FakeMouse.keyDown = FakeMouse.KeyDown
34
	local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
35
	local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
36
		CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
37
	end}
38
	--Merged 2 functions into one by checking amount of arguments
39
	CAS.UnbindAction = CAS.BindAction
40
41
	--This function will trigger the events that have been :Connect()'ed
42
	local function TriggerEvent(self,ev,...)
43
		for _,f in pairs(self[ev].Functions) do
44
			f(...)
45
		end
46
	end
47
	FakeMouse.TriggerEvent = TriggerEvent
48
	UIS.TriggerEvent = TriggerEvent
49
50
	--Client communication
51
	local Event = Instance.new("RemoteEvent")
52
	Event.Name = "UserInput_Event"
53
	Event.OnServerEvent:Connect(function(plr,io)
54
	    if plr~=RealPlayer then return end
55
		FakeMouse.Target = io.Target
56
		FakeMouse.Hit = io.Hit
57
		if not io.isMouse then
58
			local b = io.UserInputState == Enum.UserInputState.Begin
59
			if io.UserInputType == Enum.UserInputType.MouseButton1 then
60
				return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
61
			end
62
			if io.UserInputType == Enum.UserInputType.MouseButton2 then
63
				return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
64
			end
65
			for _,t in pairs(CAS.Actions) do
66
				for _,k in pairs(t.Keys) do
67
					if k==io.KeyCode then
68
						t.Function(t.Name,io.UserInputState,io)
69
					end
70
				end
71
			end
72
			FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
73
			UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
74
	    end
75
	end)
76
	Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
77
	local Mouse = owner:GetMouse()
78
	local UIS = game:GetService("UserInputService")
79
	local input = function(io,RobloxHandled)
80
		if RobloxHandled then return end
81
		--Since InputObject is a client-side instance, we create and pass table instead
82
		Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
83
	end
84
	UIS.InputBegan:Connect(input)
85
	UIS.InputEnded:Connect(input)
86
87
	local h,t
88
	--Give the server mouse data every second frame, but only if the values changed
89
	--If player is not moving their mouse, client won't fire events
90
	local HB = game:GetService("RunService").Heartbeat
91
	while true do
92
		if h~=Mouse.Hit or t~=Mouse.Target then
93
			h,t=Mouse.Hit,Mouse.Target
94
			Event:FireServer({isMouse=true,Target=t,Hit=h})
95
		end
96
		--Wait 2 frames
97
		for i=1,2 do
98
			HB:Wait()
99
		end
100
	end]==],script)
101
102
	----Sandboxed game object that allows the usage of client-side methods and services
103
	--Real game object
104
	local RealGame = game
105
106
	--Metatable for fake service
107
	local FakeService_Metatable = {
108
		__index = function(self,k)
109
			local s = rawget(self,"_RealService")
110
			if s then
111
				return typeof(s[k])=="function"
112
				and function(_,...)return s[k](s,...)end or s[k]
113
			end
114
		end,
115
		__newindex = function(self,k,v)
116
			local s = rawget(self,"_RealService")
117
			if s then s[k]=v end
118
		end
119
	}
120
	local function FakeService(t,RealService)
121
		t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
122
		return setmetatable(t,FakeService_Metatable)
123
	end
124
125
	--Fake game object
126
	local FakeGame = {
127
		GetService = function(self,s)
128
			return rawget(self,s) or RealGame:GetService(s)
129
		end,
130
		Players = FakeService({
131
			LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
132
		},"Players"),
133
		UserInputService = FakeService(UIS,"UserInputService"),
134
		ContextActionService = FakeService(CAS,"ContextActionService"),
135
		RunService = FakeService({
136
			_btrs = {},
137
			RenderStepped = RealGame:GetService("RunService").Heartbeat,
138
			BindToRenderStep = function(self,name,_,fun)
139
				self._btrs[name] = self.Heartbeat:Connect(fun)
140
			end,
141
			UnbindFromRenderStep = function(self,name)
142
				self._btrs[name]:Disconnect()
143
			end,
144
		},"RunService")
145
	}
146
	rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
147
	FakeGame.service = FakeGame.GetService
148
	FakeService(FakeGame,game)
149
	--Changing owner to fake player object to support owner:GetMouse()
150
	game,owner = FakeGame,FakeGame.Players.LocalPlayer
151
end
152
153
154
155
156
157
local player = game:GetService("Players").LocalPlayer
158
local char = player.Character
159
local mouse = player:GetMouse()
160
local knife = true
161
local phone = false
162
local rs = char.Torso["Right Shoulder"]
163
local activated = false
164
local Revolver = false
165
local readyts = true
166
local dmg = false
167
local hum = char.Humanoid
168
local chara = false
169
local LS = char.Torso["Left Shoulder"]
170
local RH = char.Torso["Right Hip"]
171
local LH = char.Torso["Left Hip"]
172
local RJ = char.HumanoidRootPart.RootJoint
173
local spinSpecial = false
174
local slash = false
175
--------------------------------------------------------[[Settings]]
176
char.Humanoid.MaxHealth = 200
177
char.Humanoid.Health = 200
178
--------------------------------------------------------[[Tools,Sounds]]
179
local Knife = Instance.new("Part",char)
180
Knife.Size = Vector3.new(0.2,3,0.8)
181
Knife.CanCollide = false
182
mesh = Instance.new("SpecialMesh")
183
mesh.Parent = Knife
184
mesh.MeshId = "http://www.roblox.com/asset/?id=121944778"
185
mesh.TextureId = "http://www.roblox.com/asset/?id=358682478"
186
weld = Instance.new("Weld")
187
weld.Parent = char
188
weld.Part0 = char["Right Arm"]
189
weld.Part1 = Knife
190
weld.C0 = CFrame.new(0,-1,-1) * CFrame.Angles(-1.57,0,0)
191
local realKnife = Instance.new("Part",char)
192
realKnife.Size = Vector3.new(0.2,3,0.8)
193
realKnife.CanCollide = false
194
meshaa = Instance.new("SpecialMesh")
195
meshaa.Parent = realKnife
196
meshaa.MeshId = "http://www.roblox.com/asset/?id=121944778"
197
meshaa.TextureId = "http://www.roblox.com/asset/?id=362719969"
198
realKnife.Transparency = 1
199
weldsa = Instance.new("Weld")
200
weldsa.Parent = char
201
weldsa.Part0 = char["Right Arm"]
202
weldsa.Part1 = realKnife
203
weldsa.C0 = CFrame.new(0,-1,-1) * CFrame.Angles(-1.57,0,0)
204
local SlashSound = Instance.new("Sound", Knife)
205
SlashSound.SoundId = "rbxassetid://394934205"
206
local DamageSound = Instance.new("Sound",Knife)
207
DamageSound.SoundId = "rbxassetid://388826051"
208
local Pp = Instance.new("Part",char)
209
		Pp.Size = Vector3.new(0.6,1.1,0.2)
210
		Pp.CanCollide = false
211
		Pp.Transparency = 1
212
		meshphon = Instance.new("SpecialMesh",Pp)
213
		meshphon.MeshId = "http://www.roblox.com/asset/?id=268471347"
214
		meshphon.TextureId = "http://www.roblox.com/asset/?id=270166778"
215
		meshphon.Scale = Vector3.new(1.8,1.8,1)
216
		weld2 = Instance.new("Weld")
217
		weld2.Parent = char
218
		weld2.Part0 = char["Right Arm"]
219
		weld2.Part1 = Pp
220
		weld2.C0 = CFrame.new(0,-0.6,-1) * CFrame.Angles(2,0,3.14)
221
local revol = Instance.new("Part",char)
222
revol.Size = Vector3.new(0.2,1.83,1.03)
223
revol.CanCollide = false
224
revol.Transparency = 1
225
local shotSound = Instance.new("Sound",revol)
226
shotSound.SoundId = "rbxassetid://145080998"
227
shotSound.PlaybackSpeed = 3
228
meshrevol = Instance.new("SpecialMesh",revol)
229
meshrevol.MeshId = "http://www.roblox.com/asset/?id=79401392"
230
meshrevol.TextureId = "rbxassetid://97889459"
231
meshrevol.Scale = Vector3.new(1.6,1.6,1.6)
232
meshrevol.VertexColor = Vector3.new(1,0.9,0)
233
weld3 = Instance.new("Weld")
234
weld3.Parent = char
235
weld3.Part0 = char["Right Arm"]
236
weld3.Part1 = revol
237
weld3.C0 = CFrame.new(0,-1.4,-0.3) * CFrame.Angles(3.14,0,0)
238
music = Instance.new("Sound")
239
music.Parent = char
240
music.SoundId = "rbxassetid://399570826"
241
music.Volume = 2
242
music.PlaybackSpeed = 1.15
243
music.Looped = true
244
laugh = Instance.new("Sound")
245
laugh.Parent = char
246
laugh.SoundId = "rbxassetid://319332735"
247
laugh.Volume = 4
248
--------------------------------------------------------[[Gui]]
249
local menu = Instance.new("ScreenGui")
250
menu.Parent = player.PlayerGui
251
local Frame = Instance.new("ImageLabel", menu)
252
Frame.Image = "rbxassetid://48656662"
253
Frame.Size = UDim2.new(0,200,0,300)
254
Frame.BackgroundTransparency = 1
255
Frame.Position = UDim2.new(0,10,0,200)
256
Frame.Visible = false
257
local button = Instance.new("TextButton", Frame)
258
button.Size = UDim2.new(1,-10,0,30)
259
button.Position = UDim2.new(0,10,0,10)
260
button.BackgroundTransparency = 1
261
button.Text = "Revolver(Yellow Soul)"
262
button.BorderSizePixel = 0
263
button.TextColor3 = Color3.new(255,255,255)
264
button.TextStrokeTransparency = 0
265
button.Font = "SciFi"
266
button.TextScaled = true
267
--------------------------------------------------------[[Gui Scripts]]
268
button.MouseButton1Click:connect(function()
269
	if Revolver == true then
270
		Revolver = false
271
		button.TextColor3 = Color3.new(255,255,255)
272
	elseif Revolver == false then
273
		Revolver = true
274
		button.TextColor3 = Color3.new(255,255,0)
275
	end
276
end)
277
--------------------------------------------------------[[Animations]]
278
slash = Instance.new("Animation",workspace)
279
slash.AnimationId = "http://www.roblox.com/asset/?id=186934753"
280
shoot = Instance.new("Animation",workspace)
281
shoot.AnimationId = "http://www.roblox.com/Asset?ID=95383980"
282
--------------------------------------------------------[[Damage Functions]]
283
function DamageObject(hit)
284
	local char=hit.Parent
285
	if char and char~=player.Character and char.Name~="Arms_Model" and hit.Name~="Handle" and dmg == false then
286
		local h=char:FindFirstChild("Humanoid")
287
		if h and h.Health > 0 then
288
			DamageSound:Play()
289
			h:TakeDamage(35)
290
			if h.Health == 0 then
291
			end
292
			dmg = true
293
			wait(1.5)
294
		end
295
	end
296
end
297
function shot(hit)
298
	local char=hit.Parent
299
	if char and char~=player.Character and char.Name~="Arms_Model" and hit.Name~="Handle" then
300
		local h=char:FindFirstChild("Humanoid")
301
		if h and h.Health > 0 then
302
			h:TakeDamage(10)
303
			if h.Health == 0 then
304
			end
305
		end
306
	end
307
end
308
function CharaDmg(hit)
309
	local char=hit.Parent
310
	if char and char~=player.Character and char.Name~="Arms_Model" and hit.Name~="Handle" and dmg == false then
311
		local h=char:FindFirstChild("Humanoid")
312
		if h and h.Health > 0 then
313
			DamageSound:Play()
314
			h:TakeDamage(105)
315
			if h.Health == 0 then
316
			end
317
			dmg = true
318
			wait(1.5)
319
		end
320
	end
321
end
322
--------------------------------------------------------[[Normal Actions]]
323
mouse.KeyDown:connect(function(key)
324
	Key = key:lower()
325
	if Key == "z" and knife == true and phone == false and chara == false then -- Normal Slash
326
		knife = false
327
		dmg = false
328
		local slashstart = char.Humanoid:LoadAnimation(slash)
329
		Knife.Touched:connect(DamageObject)
330
		slashstart:Play()
331
		SlashSound:Play()
332
		wait(0.76)
333
		knife = true
334
	elseif Key == "c" and knife == true and phone == false and chara == false then -- Phone
335
		knife = false
336
		phone = true
337
		Knife.Transparency = 1
338
		for i = 1,5 do
339
			rs.C0 = rs.C0 * CFrame.Angles(0,0,0.157)
340
			wait()
341
		end
342
		Frame.Visible = true
343
		Pp.Transparency = 0
344
		local menu = Instance.new("ScreenGui")
345
		menu.Parent = player.PlayerGui
346
		local button = Instance.new("TextButton", menu)
347
	elseif Key == "c" and knife == false and phone == true and Revolver == false and chara == false then -- phone Gui
348
		knife = true
349
		phone = false
350
		for i = 1,5 do
351
			rs.C0 = rs.C0 * CFrame.Angles(0,0,-0.157)
352
			wait()
353
		end
354
		Frame.Visible = false
355
		Knife.Transparency = 0
356
		Pp.Transparency = 1
357
	elseif Key == "c" and Revolver == true and phone == true and chara == false then
358
		phone = false
359
		revol.Transparency = 0
360
		Pp.Transparency = 1
361
		Frame.Visible = false
362
		for i = 1,5 do
363
			rs.C0 = rs.C0 * CFrame.Angles(0,0,-0.157)
364
			wait()
365
		end
366
	elseif Key == "c" and Revolver == true and phone == false and chara == false then
367
		phone = true
368
		Frame.Visible = true
369
		revol.Transparency = 1
370
		Pp.Transparency = 0
371
		for i = 1,5 do
372
			rs.C0 = rs.C0 * CFrame.Angles(0,0,0.157)
373
			wait()
374
		end
375
	elseif Key == "z" and Revolver == true then -- Revolver Script
376
		local shootstart = char.Humanoid:LoadAnimation(shoot)
377
		if (not readyts) then return end
378
	readyts = false
379
	targ = mouse.Target
380
	if (targ == nil) then 
381
		readyts = true
382
		return 
383
	end
384
	hum = targ.Parent:findFirstChild("Humanoid")
385
	Hit = mouse.hit
386
	shootstart:Play()
387
	shotSound:Play()
388
	local P = Instance.new("Part",char) 
389
	P.Name = "BulletTrail" 
390
	local Place0 = revol.CFrame 
391
	P.formFactor = 0 
392
	P.Size = Vector3.new(0,0,(Place0.p - Hit.p).magnitude) 
393
	P.CFrame = CFrame.new((Place0.p + Hit.p)/2,Place0.p) 
394
	P.Anchored = true 
395
	P.CanCollide = false
396
	P.BrickColor = BrickColor.new("White")
397
	P.Touched:connect(shot)
398
	for count = 1, 10 do
399
		P.Transparency = count/10
400
		wait()
401
	end
402
	P:remove()
403
	readyts = true
404
	elseif Key == "b" and chara == false and phone == false and Revolver == false then -- Chara Mode
405
		dmg = false
406
		chara = true
407
		local eye = Instance.new("Part")
408
		eye.Parent = game.Workspace
409
		eye.Size = Vector3.new(0,0,0)
410
		eye.BrickColor = BrickColor.new("Bright red")
411
		eye.Transparency = 0.3
412
		eye.Anchored = true
413
		eye.CanCollide = false
414
		eye.CFrame = char.Head.CFrame * CFrame.new(0.1,0.2,-0.6)
415
		local mesh = Instance.new("SpecialMesh")
416
		mesh.Parent = eye
417
		mesh.MeshType = "Sphere"
418
		char.Torso.Anchored = true
419
		char.Head.face.Parent = char.Humanoid
420
		local charaface = Instance.new("Decal")
421
		charaface.Parent = char.Head
422
		charaface.Texture = "http://www.roblox.com/asset/?id=435233416"
423
		char.Humanoid.MaxHealth = 1000
424
		char.Humanoid.Health = 1000
425
		laugh:Play()
426
		for i = 1,20 do
427
			mesh.Scale = mesh.Scale + Vector3.new(2,0,0)
428
			eye.Transparency = eye.Transparency + 0.035
429
			wait()
430
		end
431
		char.Torso.Anchored = false
432
		char.Humanoid.WalkSpeed = 32
433
		Knife.Touched:connect(CharaDmg)
434
		realKnife.Transparency = 0
435
		Knife.Transparency = 1
436
		music:Play()
437
	elseif Key == "z" and chara == true and knife == true then -- Chara Slash
438
		knife = false
439
		local slashstart = char.Humanoid:LoadAnimation(slash)
440
		slashstart:Play()
441
		SlashSound:Play()
442
		wait(0.1)
443
		knife = true
444
	elseif Key == "b" and chara == true then
445
		chara = false
446
		realKnife.Transparency = 1
447
		Knife.Transparency = 0
448
		music:Stop()
449
		char.Humanoid.WalkSpeed = 16
450
		char.Humanoid.MaxHealth = 200
451
		char.Humanoid.Health = 200
452
		char.Humanoid.face.Parent = char.Head
453
		char.Head.Decal:Destroy()
454
	elseif Key == "f" and knife == true and phone == false and Revolver == false and spinSpecial == false and chara == false then
455
		spinSpecial = true
456
		rs.C0 = rs.C0 * CFrame.Angles(0,0.785,1.57)
457
		LS.C0 = LS.C0 * CFrame.Angles(0,-0.785,-1.57)
458
		LH.C0 = LH.C0 * CFrame.Angles(0,0,0.39) * CFrame.new(0,1,0)
459
		RH.C0 = RH.C0 * CFrame.Angles(0,0,-0.39) * CFrame.new(0,1,0)
460
		SlashSound:Play()
461
		Knife.Touched:connect(DamageObject)
462
		for i = 1,24 do
463
			dmg = false
464
			Knife.Touched:connect(DamageObject)
465
			RJ.C0 = RJ.C0 * CFrame.Angles(0.785,0,0)
466
			wait(0.008)
467
		end
468
		dmg = true
469
		spinSpecial = false
470
		LH.C0 = LH.C0 * CFrame.new(0,-1,0)
471
		RH.C0 = RH.C0 * CFrame.new(0,-1,0)
472
		LH.C0 = LH.C0 * CFrame.Angles(0,0,-0.39)
473
		RH.C0 = RH.C0 * CFrame.Angles(0,0,0.39)
474
		rs.C0 = rs.C0 * CFrame.Angles(-0.785,0,-1.57)
475
		LS.C0 = LS.C0 * CFrame.Angles(-0.785,0,1.57)
476
	elseif Key == "f" and knife == true and chara == true and spinSpecial == false then
477
		spinSpecial = true
478
		rs.C0 = rs.C0 * CFrame.Angles(0,0.785,1.57)
479
		LS.C0 = LS.C0 * CFrame.Angles(0,-0.785,-1.57)
480
		LH.C0 = LH.C0 * CFrame.Angles(0,0,0.39) * CFrame.new(0,1,0)
481
		RH.C0 = RH.C0 * CFrame.Angles(0,0,-0.39) * CFrame.new(0,1,0)
482
		SlashSound:Play()
483
		Knife.Touched:connect(CharaDmg)
484
		for i = 1,24 do
485
			dmg = false
486
			Knife.Touched:connect(CharaDmg)
487
			RJ.C0 = RJ.C0 * CFrame.Angles(0.785,0,0)
488
			wait(0.008)
489
		end
490
		dmg = true
491
		spinSpecial = false
492
		LH.C0 = LH.C0 * CFrame.new(0,-1,0)
493
		RH.C0 = RH.C0 * CFrame.new(0,-1,0)
494
		LH.C0 = LH.C0 * CFrame.Angles(0,0,-0.39)
495
		RH.C0 = RH.C0 * CFrame.Angles(0,0,0.39)
496
		rs.C0 = rs.C0 * CFrame.Angles(-0.785,0,-1.57)
497
		LS.C0 = LS.C0 * CFrame.Angles(-0.785,0,1.57)
498
	end
499
end)