Advertisement
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
- p = (game.Players.LocalPlayer.Name)
- char = game.Players.LocalPlayer.Character
- local player = game.Players.LocalPlayer
- repeat wait() until player.Character.Humanoid
- local humanoid = player.Character.Humanoid
- local mouse = player:GetMouse()
- for i,v in pairs(char:GetChildren()) do
- if v.ClassName == 'Hat' then
- v:Destroy()
- end
- end
- ScarySound1 = Instance.new("Sound")
- ScarySound1.Parent = char.Torso
- ScarySound1.SoundId = "rbxassetid://177113856"
- ScarySound1.Volume = 1
- ScarySound2 = Instance.new("Sound")
- ScarySound2.Parent = char.Torso
- ScarySound2.SoundId = "rbxassetid://234313800"
- ScarySound2.Volume = 0.5
- ScarySound2.Looped = true
- ScarySound3 = Instance.new("Sound")
- ScarySound3.Parent = char.Torso
- ScarySound3.SoundId = "rbxassetid://254933693"
- ScarySound3.Volume = 0.5
- ScarySound3.Looped = true
- Punch = Instance.new("Sound")
- Punch.Parent = char.Torso
- Punch.SoundId = "rbxassetid://261566877"
- Punch.Volume = 1
- Punch.Looped = false
- hole = Instance.new("Sound")
- hole.Parent = char.Torso
- hole.SoundId = "rbxassetid://266364769"
- hole.Volume = 1
- hole.Looped = false
- game.Players.LocalPlayer.Character.Sound:Destroy()
- function Normal()
- ScarySound3:Play()
- char.Humanoid.WalkSpeed = 16
- char.Head.face.Texture = "rbxassetid://443236276"
- char["Left Leg"].Transparency = 0.5
- char["Head"].Transparency = 0.5
- char["Right Leg"].Transparency = 0.5
- char["Torso"].Transparency = 0.5
- char["Left Arm"].Transparency = 0.5
- char["Right Arm"].Transparency = 0.5
- end
- function GoInvisible()
- ScarySound3:Stop()
- ScarySound1:Stop()
- char.Humanoid.WalkSpeed = 120
- char.Head.face.Transparency = 1
- char["Left Leg"].Transparency = 0.5
- char["Head"].Transparency = 0.5
- char["Right Leg"].Transparency = 0.5
- char["Torso"].Transparency = 0.5
- char["Left Arm"].Transparency = 0.5
- char["Right Arm"].Transparency = 0.5
- wait(0.001)
- char["Left Leg"].Transparency = 0.6
- char["Head"].Transparency = 0.6
- char["Right Leg"].Transparency = 0.6
- char["Torso"].Transparency = 0.6
- char["Left Arm"].Transparency = 0.6
- char["Right Arm"].Transparency = 0.6
- wait(0.001)
- char["Left Leg"].Transparency = 0.7
- char["Head"].Transparency = 0.7
- char["Right Leg"].Transparency = 0.7
- char["Torso"].Transparency = 0.7
- char["Left Arm"].Transparency = 0.7
- char["Right Arm"].Transparency = 0.7
- wait(0.001)
- char["Left Leg"].Transparency = 1
- char["Head"].Transparency = 1
- char["Right Leg"].Transparency = 1
- char["Torso"].Transparency = 1
- char["Left Arm"].Transparency = 1
- char["Right Arm"].Transparency = 1
- end
- function GoVisible()
- ScarySound3:Play()
- char.Humanoid.WalkSpeed = 16
- ScarySound1:Play()
- char.Head.face.Transparency = 0
- char["Left Leg"].Transparency = 0.9
- char["Head"].Transparency = 0.9
- char["Right Leg"].Transparency = 9
- char["Torso"].Transparency = 0.9
- char["Left Arm"].Transparency = 0.9
- char["Right Arm"].Transparency = 0.9
- wait(0.001)
- char["Left Leg"].Transparency = 0.7
- char["Head"].Transparency = 0.7
- char["Right Leg"].Transparency = 0.7
- char["Torso"].Transparency = 0.7
- char["Left Arm"].Transparency = 0.7
- char["Right Arm"].Transparency = 0.7
- wait(0.001)
- char["Left Leg"].Transparency = 0.5
- char["Head"].Transparency = 0.5
- char["Right Leg"].Transparency = 0.5
- char["Torso"].Transparency = 0.5
- char["Left Arm"].Transparency = 0.5
- char["Right Arm"].Transparency = 0.5
- end
- Normal()
- local anim = Instance.new("Animation")
- anim.AnimationId = "rbxassetid://191123156"
- mouse.KeyDown:connect(function(key)
- if key == "z" then
- if char.Head.Transparency == 0.5 then
- GoInvisible()
- elseif char.Head.Transparency == 1 then
- GoVisible()
- end
- end end)
- mouse.KeyDown:connect(function(key)
- if key == "x" then
- if ScarySound2.IsPlaying == false then
- ScarySound2:Play()
- elseif ScarySound2.IsPlaying == true then
- ScarySound2:Stop()
- end
- end end)
- function onTouch(part)
- local humanoid = part.Parent:findFirstChild("Humanoid")
- local model = part.Parent
- local torso = part.Parent:findFirstChild("Torso")
- local head = part.Parent:findFirstChild("Head")
- local leftleg = part.Parent:findFirstChild("Left Leg")
- local rightleg = part.Parent:findFirstChild("Right Leg")
- local leftarm = part.Parent:findFirstChild("Left Arm")
- local rightarm = part.Parent:findFirstChild("Right Arm")
- if (humanoid ~=nil) then
- --humanoid.Health = 0
- head.BrickColor = BrickColor.new("Really black")
- torso.BrickColor = BrickColor.new("Really black")
- leftleg.BrickColor = BrickColor.new("Really black")
- rightleg.BrickColor = BrickColor.new("Really black")
- rightarm.BrickColor = BrickColor.new("Really black")
- leftarm.BrickColor = BrickColor.new("Really black")
- humanoid.Sit = true
- wait(0.5)
- torso.Anchored = true
- wait(3)
- e=Instance.new('Part', model)
- e.Size = Vector3.new(2.25,2.25,2.25)
- e.Transparency = 1
- e.Anchored = true
- e.CFrame = CFrame.new(head.Position)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(0.1)
- head.Mesh.Scale = head.Mesh.Scale + Vector3.new(0.01,0.01,0.01)
- wait(2)
- head:Destroy()
- q=Instance.new('ParticleEmitter', e)
- q.Size = NumberSequence.new(0.5)
- q.Rate = 50
- q.Transparency = NumberSequence.new(0.5)
- q.Speed = NumberRange.new(7)
- q.VelocitySpread = 100
- q.Lifetime = NumberRange.new(1)
- q.Texture = 'rbxassetid://122275188'
- torso.Anchored = true
- rightleg.Anchored = true
- leftleg.Anchored = true
- rightarm.Anchored = true
- leftarm.Anchored = true
- ded = Instance.new("Sound")
- ded.Parent = torso
- ded.SoundId = "rbxassetid://131060226"
- ded.Volume = 1
- ded.Looped = false
- wait()
- ded:Play()
- end
- end
- char.Torso.Touched:connect(onTouch)
- mouse.KeyDown:connect(function(key)
- if key == "c" then
- local playAnim = humanoid:LoadAnimation(anim)
- Punch:Play()
- playAnim:Play()
- end
- end)
- debounce = false
- function onTouched(hit)
- hole:Play()
- hit.CanCollide=false
- wait(.5)
- hit.CanCollide = true
- debounce = true
- end
- game.Players.LocalPlayer.Character.Torso.Touched:connect(onTouched)
- while wait() do
- char["Left Leg"].BrickColor = BrickColor.new("Really black")
- char["Head"].BrickColor = BrickColor.new("Really black")
- char["Right Leg"].BrickColor = BrickColor.new("Really black")
- char["Torso"].BrickColor = BrickColor.new("Really black")
- char["Left Arm"].BrickColor = BrickColor.new("Really black")
- char["Right Arm"].BrickColor = BrickColor.new("Really black")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement