Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://github.com/Mokiros/roblox-FE-compatibility
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do
- print("FE Compatibility code V2 by Mokiros")
- local RealPlayer = RealPlayer
- script.Parent = RealPlayer.Character
- --Fake event to make stuff like Mouse.KeyDown work
- local Disconnect_Function = function(this)
- this[1].Functions[this[2]] = nil
- end
- local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
- local FakeEvent_Metatable = {__index={
- Connect = function(this,f)
- local i = tostring(math.random(0,10000))
- while this.Functions[i] do
- i = tostring(math.random(0,10000))
- end
- this.Functions[i] = f
- return setmetatable({this,i},Disconnect_Metatable)
- end
- }}
- FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
- local function fakeEvent()
- return setmetatable({Functions={}},FakeEvent_Metatable)
- end
- --Creating fake input objects with fake variables
- local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- FakeMouse.keyUp = FakeMouse.KeyUp
- FakeMouse.keyDown = FakeMouse.KeyDown
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function TriggerEvent(self,ev,...)
- for _,f in pairs(self[ev].Functions) do
- f(...)
- end
- end
- FakeMouse.TriggerEvent = TriggerEvent
- UIS.TriggerEvent = TriggerEvent
- --Client communication
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=RealPlayer then return end
- FakeMouse.Target = io.Target
- FakeMouse.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
- local Mouse = owner:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,RobloxHandled)
- if RobloxHandled then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data every second frame, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- local HB = game:GetService("RunService").Heartbeat
- while true do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- --Wait 2 frames
- for i=1,2 do
- HB:Wait()
- end
- end]==],script)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local RealGame = game
- --Metatable for fake service
- local FakeService_Metatable = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then
- return typeof(s[k])=="function"
- and function(_,...)return s[k](s,...)end or s[k]
- end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
- return setmetatable(t,FakeService_Metatable)
- end
- --Fake game object
- local FakeGame = {
- GetService = function(self,s)
- return rawget(self,s) or RealGame:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = RealGame:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- }
- rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
- FakeGame.service = FakeGame.GetService
- FakeService(FakeGame,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = FakeGame,FakeGame.Players.LocalPlayer
- end
- local player = game:GetService("Players").LocalPlayer
- local char = player.Character
- local mouse = player:GetMouse()
- local knife = true
- local phone = false
- local rs = char.Torso["Right Shoulder"]
- local activated = false
- local Revolver = false
- local readyts = true
- local dmg = false
- local hum = char.Humanoid
- local chara = false
- local LS = char.Torso["Left Shoulder"]
- local RH = char.Torso["Right Hip"]
- local LH = char.Torso["Left Hip"]
- local RJ = char.HumanoidRootPart.RootJoint
- local spinSpecial = false
- local slash = false
- --------------------------------------------------------[[Settings]]
- char.Humanoid.MaxHealth = 200
- char.Humanoid.Health = 200
- --------------------------------------------------------[[Tools,Sounds]]
- local Knife = Instance.new("Part",char)
- Knife.Size = Vector3.new(0.2,3,0.8)
- Knife.CanCollide = false
- mesh = Instance.new("SpecialMesh")
- mesh.Parent = Knife
- mesh.MeshId = "http://www.roblox.com/asset/?id=121944778"
- mesh.TextureId = "http://www.roblox.com/asset/?id=358682478"
- weld = Instance.new("Weld")
- weld.Parent = char
- weld.Part0 = char["Right Arm"]
- weld.Part1 = Knife
- weld.C0 = CFrame.new(0,-1,-1) * CFrame.Angles(-1.57,0,0)
- local realKnife = Instance.new("Part",char)
- realKnife.Size = Vector3.new(0.2,3,0.8)
- realKnife.CanCollide = false
- meshaa = Instance.new("SpecialMesh")
- meshaa.Parent = realKnife
- meshaa.MeshId = "http://www.roblox.com/asset/?id=121944778"
- meshaa.TextureId = "http://www.roblox.com/asset/?id=362719969"
- realKnife.Transparency = 1
- weldsa = Instance.new("Weld")
- weldsa.Parent = char
- weldsa.Part0 = char["Right Arm"]
- weldsa.Part1 = realKnife
- weldsa.C0 = CFrame.new(0,-1,-1) * CFrame.Angles(-1.57,0,0)
- local SlashSound = Instance.new("Sound", Knife)
- SlashSound.SoundId = "rbxassetid://394934205"
- local DamageSound = Instance.new("Sound",Knife)
- DamageSound.SoundId = "rbxassetid://388826051"
- local Pp = Instance.new("Part",char)
- Pp.Size = Vector3.new(0.6,1.1,0.2)
- Pp.CanCollide = false
- Pp.Transparency = 1
- meshphon = Instance.new("SpecialMesh",Pp)
- meshphon.MeshId = "http://www.roblox.com/asset/?id=268471347"
- meshphon.TextureId = "http://www.roblox.com/asset/?id=270166778"
- meshphon.Scale = Vector3.new(1.8,1.8,1)
- weld2 = Instance.new("Weld")
- weld2.Parent = char
- weld2.Part0 = char["Right Arm"]
- weld2.Part1 = Pp
- weld2.C0 = CFrame.new(0,-0.6,-1) * CFrame.Angles(2,0,3.14)
- local revol = Instance.new("Part",char)
- revol.Size = Vector3.new(0.2,1.83,1.03)
- revol.CanCollide = false
- revol.Transparency = 1
- local shotSound = Instance.new("Sound",revol)
- shotSound.SoundId = "rbxassetid://145080998"
- shotSound.PlaybackSpeed = 3
- meshrevol = Instance.new("SpecialMesh",revol)
- meshrevol.MeshId = "http://www.roblox.com/asset/?id=79401392"
- meshrevol.TextureId = "rbxassetid://97889459"
- meshrevol.Scale = Vector3.new(1.6,1.6,1.6)
- meshrevol.VertexColor = Vector3.new(1,0.9,0)
- weld3 = Instance.new("Weld")
- weld3.Parent = char
- weld3.Part0 = char["Right Arm"]
- weld3.Part1 = revol
- weld3.C0 = CFrame.new(0,-1.4,-0.3) * CFrame.Angles(3.14,0,0)
- music = Instance.new("Sound")
- music.Parent = char
- music.SoundId = "rbxassetid://399570826"
- music.Volume = 2
- music.PlaybackSpeed = 1.15
- music.Looped = true
- laugh = Instance.new("Sound")
- laugh.Parent = char
- laugh.SoundId = "rbxassetid://319332735"
- laugh.Volume = 4
- --------------------------------------------------------[[Gui]]
- local menu = Instance.new("ScreenGui")
- menu.Parent = player.PlayerGui
- local Frame = Instance.new("ImageLabel", menu)
- Frame.Image = "rbxassetid://48656662"
- Frame.Size = UDim2.new(0,200,0,300)
- Frame.BackgroundTransparency = 1
- Frame.Position = UDim2.new(0,10,0,200)
- Frame.Visible = false
- local button = Instance.new("TextButton", Frame)
- button.Size = UDim2.new(1,-10,0,30)
- button.Position = UDim2.new(0,10,0,10)
- button.BackgroundTransparency = 1
- button.Text = "Revolver(Yellow Soul)"
- button.BorderSizePixel = 0
- button.TextColor3 = Color3.new(255,255,255)
- button.TextStrokeTransparency = 0
- button.Font = "SciFi"
- button.TextScaled = true
- --------------------------------------------------------[[Gui Scripts]]
- button.MouseButton1Click:connect(function()
- if Revolver == true then
- Revolver = false
- button.TextColor3 = Color3.new(255,255,255)
- elseif Revolver == false then
- Revolver = true
- button.TextColor3 = Color3.new(255,255,0)
- end
- end)
- --------------------------------------------------------[[Animations]]
- slash = Instance.new("Animation",workspace)
- slash.AnimationId = "http://www.roblox.com/asset/?id=186934753"
- shoot = Instance.new("Animation",workspace)
- shoot.AnimationId = "http://www.roblox.com/Asset?ID=95383980"
- --------------------------------------------------------[[Damage Functions]]
- function DamageObject(hit)
- local char=hit.Parent
- if char and char~=player.Character and char.Name~="Arms_Model" and hit.Name~="Handle" and dmg == false then
- local h=char:FindFirstChild("Humanoid")
- if h and h.Health > 0 then
- DamageSound:Play()
- h:TakeDamage(35)
- if h.Health == 0 then
- end
- dmg = true
- wait(1.5)
- end
- end
- end
- function shot(hit)
- local char=hit.Parent
- if char and char~=player.Character and char.Name~="Arms_Model" and hit.Name~="Handle" then
- local h=char:FindFirstChild("Humanoid")
- if h and h.Health > 0 then
- h:TakeDamage(10)
- if h.Health == 0 then
- end
- end
- end
- end
- function CharaDmg(hit)
- local char=hit.Parent
- if char and char~=player.Character and char.Name~="Arms_Model" and hit.Name~="Handle" and dmg == false then
- local h=char:FindFirstChild("Humanoid")
- if h and h.Health > 0 then
- DamageSound:Play()
- h:TakeDamage(105)
- if h.Health == 0 then
- end
- dmg = true
- wait(1.5)
- end
- end
- end
- --------------------------------------------------------[[Normal Actions]]
- mouse.KeyDown:connect(function(key)
- Key = key:lower()
- if Key == "z" and knife == true and phone == false and chara == false then -- Normal Slash
- knife = false
- dmg = false
- local slashstart = char.Humanoid:LoadAnimation(slash)
- Knife.Touched:connect(DamageObject)
- slashstart:Play()
- SlashSound:Play()
- wait(0.76)
- knife = true
- elseif Key == "c" and knife == true and phone == false and chara == false then -- Phone
- knife = false
- phone = true
- Knife.Transparency = 1
- for i = 1,5 do
- rs.C0 = rs.C0 * CFrame.Angles(0,0,0.157)
- wait()
- end
- Frame.Visible = true
- Pp.Transparency = 0
- local menu = Instance.new("ScreenGui")
- menu.Parent = player.PlayerGui
- local button = Instance.new("TextButton", menu)
- elseif Key == "c" and knife == false and phone == true and Revolver == false and chara == false then -- phone Gui
- knife = true
- phone = false
- for i = 1,5 do
- rs.C0 = rs.C0 * CFrame.Angles(0,0,-0.157)
- wait()
- end
- Frame.Visible = false
- Knife.Transparency = 0
- Pp.Transparency = 1
- elseif Key == "c" and Revolver == true and phone == true and chara == false then
- phone = false
- revol.Transparency = 0
- Pp.Transparency = 1
- Frame.Visible = false
- for i = 1,5 do
- rs.C0 = rs.C0 * CFrame.Angles(0,0,-0.157)
- wait()
- end
- elseif Key == "c" and Revolver == true and phone == false and chara == false then
- phone = true
- Frame.Visible = true
- revol.Transparency = 1
- Pp.Transparency = 0
- for i = 1,5 do
- rs.C0 = rs.C0 * CFrame.Angles(0,0,0.157)
- wait()
- end
- elseif Key == "z" and Revolver == true then -- Revolver Script
- local shootstart = char.Humanoid:LoadAnimation(shoot)
- if (not readyts) then return end
- readyts = false
- targ = mouse.Target
- if (targ == nil) then
- readyts = true
- return
- end
- hum = targ.Parent:findFirstChild("Humanoid")
- Hit = mouse.hit
- shootstart:Play()
- shotSound:Play()
- local P = Instance.new("Part",char)
- P.Name = "BulletTrail"
- local Place0 = revol.CFrame
- P.formFactor = 0
- P.Size = Vector3.new(0,0,(Place0.p - Hit.p).magnitude)
- P.CFrame = CFrame.new((Place0.p + Hit.p)/2,Place0.p)
- P.Anchored = true
- P.CanCollide = false
- P.BrickColor = BrickColor.new("White")
- P.Touched:connect(shot)
- for count = 1, 10 do
- P.Transparency = count/10
- wait()
- end
- P:remove()
- readyts = true
- elseif Key == "b" and chara == false and phone == false and Revolver == false then -- Chara Mode
- dmg = false
- chara = true
- local eye = Instance.new("Part")
- eye.Parent = game.Workspace
- eye.Size = Vector3.new(0,0,0)
- eye.BrickColor = BrickColor.new("Bright red")
- eye.Transparency = 0.3
- eye.Anchored = true
- eye.CanCollide = false
- eye.CFrame = char.Head.CFrame * CFrame.new(0.1,0.2,-0.6)
- local mesh = Instance.new("SpecialMesh")
- mesh.Parent = eye
- mesh.MeshType = "Sphere"
- char.Torso.Anchored = true
- char.Head.face.Parent = char.Humanoid
- local charaface = Instance.new("Decal")
- charaface.Parent = char.Head
- charaface.Texture = "http://www.roblox.com/asset/?id=435233416"
- char.Humanoid.MaxHealth = 1000
- char.Humanoid.Health = 1000
- laugh:Play()
- for i = 1,20 do
- mesh.Scale = mesh.Scale + Vector3.new(2,0,0)
- eye.Transparency = eye.Transparency + 0.035
- wait()
- end
- char.Torso.Anchored = false
- char.Humanoid.WalkSpeed = 32
- Knife.Touched:connect(CharaDmg)
- realKnife.Transparency = 0
- Knife.Transparency = 1
- music:Play()
- elseif Key == "z" and chara == true and knife == true then -- Chara Slash
- knife = false
- local slashstart = char.Humanoid:LoadAnimation(slash)
- slashstart:Play()
- SlashSound:Play()
- wait(0.1)
- knife = true
- elseif Key == "b" and chara == true then
- chara = false
- realKnife.Transparency = 1
- Knife.Transparency = 0
- music:Stop()
- char.Humanoid.WalkSpeed = 16
- char.Humanoid.MaxHealth = 200
- char.Humanoid.Health = 200
- char.Humanoid.face.Parent = char.Head
- char.Head.Decal:Destroy()
- elseif Key == "f" and knife == true and phone == false and Revolver == false and spinSpecial == false and chara == false then
- spinSpecial = true
- rs.C0 = rs.C0 * CFrame.Angles(0,0.785,1.57)
- LS.C0 = LS.C0 * CFrame.Angles(0,-0.785,-1.57)
- LH.C0 = LH.C0 * CFrame.Angles(0,0,0.39) * CFrame.new(0,1,0)
- RH.C0 = RH.C0 * CFrame.Angles(0,0,-0.39) * CFrame.new(0,1,0)
- SlashSound:Play()
- Knife.Touched:connect(DamageObject)
- for i = 1,24 do
- dmg = false
- Knife.Touched:connect(DamageObject)
- RJ.C0 = RJ.C0 * CFrame.Angles(0.785,0,0)
- wait(0.008)
- end
- dmg = true
- spinSpecial = false
- LH.C0 = LH.C0 * CFrame.new(0,-1,0)
- RH.C0 = RH.C0 * CFrame.new(0,-1,0)
- LH.C0 = LH.C0 * CFrame.Angles(0,0,-0.39)
- RH.C0 = RH.C0 * CFrame.Angles(0,0,0.39)
- rs.C0 = rs.C0 * CFrame.Angles(-0.785,0,-1.57)
- LS.C0 = LS.C0 * CFrame.Angles(-0.785,0,1.57)
- elseif Key == "f" and knife == true and chara == true and spinSpecial == false then
- spinSpecial = true
- rs.C0 = rs.C0 * CFrame.Angles(0,0.785,1.57)
- LS.C0 = LS.C0 * CFrame.Angles(0,-0.785,-1.57)
- LH.C0 = LH.C0 * CFrame.Angles(0,0,0.39) * CFrame.new(0,1,0)
- RH.C0 = RH.C0 * CFrame.Angles(0,0,-0.39) * CFrame.new(0,1,0)
- SlashSound:Play()
- Knife.Touched:connect(CharaDmg)
- for i = 1,24 do
- dmg = false
- Knife.Touched:connect(CharaDmg)
- RJ.C0 = RJ.C0 * CFrame.Angles(0.785,0,0)
- wait(0.008)
- end
- dmg = true
- spinSpecial = false
- LH.C0 = LH.C0 * CFrame.new(0,-1,0)
- RH.C0 = RH.C0 * CFrame.new(0,-1,0)
- LH.C0 = LH.C0 * CFrame.Angles(0,0,-0.39)
- RH.C0 = RH.C0 * CFrame.Angles(0,0,0.39)
- rs.C0 = rs.C0 * CFrame.Angles(-0.785,0,-1.57)
- LS.C0 = LS.C0 * CFrame.Angles(-0.785,0,1.57)
- end
- end)
Add Comment
Please, Sign In to add comment