Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- thanks dark! (Dark Eccentric)
- -- all this does is basically make you dance the distraction dance from
- -- fleeing the complex
- -- but theres more!
- -- click a player or npc (needs R6)
- -- to make them dance
- -- it basically makes them not able to control their character lol
- -- alr have fun using this i guess
- 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 by Mokiros")
- local rp = RealPlayer
- script.Parent = rp.Character
- --RemoteEvent for communicating
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- --Fake event to make stuff like Mouse.KeyDown work
- local function fakeEvent()
- local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
- t.connect = t.Connect
- return t
- end
- --Creating fake input objects with fake variables
- local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- 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 te(self,ev,...)
- local t = m[ev]
- if t and t._fakeEvent then
- for _,f in pairs(t.Functions) do
- f(...)
- end
- end
- end
- m.TrigEvent = te
- UIS.TrigEvent = te
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=rp then return end
- m.Target = io.Target
- m.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return m:TrigEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return m:TrigEvent(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
- m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[
- local Player = game:GetService("Players").LocalPlayer
- local Event = script:WaitForChild("UserInput_Event")
- local Mouse = Player:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,a)
- if a 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 30 times every second, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- while wait(1/30) 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
- end]==],Player.Character)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local _rg = game
- --Metatable for fake service
- local fsmt = {
- __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 _rg:GetService(RealService) or RealService
- return setmetatable(t,fsmt)
- end
- --Fake game object
- local g = {
- GetService = function(self,s)
- return rawget(self,s) or _rg:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = _rg: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(g.Players,"localPlayer",g.Players.LocalPlayer)
- g.service = g.GetService
- FakeService(g,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = g,g.Players.LocalPlayer
- end
- char = owner.Character
- local dummy5leg1 = CFrame.new(0.8,-1,-0.5) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(15))
- local dummy5leg2 = CFrame.new(-0.8,-2,-0.2) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(-15))
- local dummy5arm1 = CFrame.new(-0.9,0.5,-0.6) * CFrame.Angles(math.rad(90),math.rad(0),math.rad(-90))
- local dummy5arm2 = CFrame.new(-1.2,0.5,0.1) * CFrame.Angles(math.rad(90),math.rad(0),math.rad(-90))
- local dummy4leg1 = CFrame.new(0.8,-2,-0.2) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(15))
- local dummy4leg2 = CFrame.new(-0.8,-1,-0.5) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(-15))
- local dummy4arm1 = CFrame.new(-1.2,0.5,0.3) * CFrame.Angles(math.rad(90),math.rad(0),math.rad(-90))
- local dummy4arm2 = CFrame.new(-0.3,0.5,-0.8) * CFrame.Angles(math.rad(90),math.rad(0),math.rad(-90))
- local dummy3leg1 = CFrame.new(0.8,-1,-0.4) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(15))
- local dummy3leg2 = CFrame.new(-0.8,-2,-0.2) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(-15))
- local dummy3arm1 = CFrame.new(1,0,-0.4) * CFrame.Angles(math.rad(30),math.rad(0),math.rad(-55))
- local dummy3arm2 = CFrame.new(-1,0,-0.4) * CFrame.Angles(math.rad(30),math.rad(0),math.rad(55))
- local dummy2leg1 = CFrame.new(0.8,-1,-0.4) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(14))
- local dummy2leg2 = CFrame.new(-0.8,-2,-0.2) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(-14))
- local dummy2arm1 = CFrame.new(1.5,0,-0.2) * CFrame.Angles(math.rad(25),math.rad(0),math.rad(45))
- local dummy2arm2 = CFrame.new(-1.5,0,-0.2) * CFrame.Angles(math.rad(25),math.rad(0),math.rad(-45))
- distract = Instance.new("Sound",char.Torso)
- distract.Volume = 5
- distract.SoundId = "rbxassetid://5549004857"
- distract.Looped = true
- distract:Play()
- limbs = {char["Left Leg"],char["Left Arm"],char["Right Arm"],char["Right Leg"]}
- function weld(part,part0,part1)
- h = Instance.new("Weld",part)
- h.Name = "distractionweld"
- h.Part0 = part0
- h.Part1 = part1
- return h
- end
- d2 = false
- d3 = false
- d4 = false
- d5 = false
- function lerp(weld,c0)
- weld.C0 = weld.C0:lerp(c0,0.25)
- end
- distractedlist = {}
- function distraction(player)
- hu = player:FindFirstChildOfClass("Humanoid")
- if hu.RigType == Enum.HumanoidRigType.R15 then return end
- hu.WalkSpeed = 0
- hu.AutoRotate = false
- hu.JumpPower = 0
- for i,v in pairs(player:GetChildren()) do
- if v.ClassName == "Part" and v.Name ~= "Torso" and v.Name ~= "HumanoidRootPart" and v.Name ~= "Head" then
- weld(v,player.Torso,v)
- end
- end
- table.insert(distractedlist,player)
- end
- lleg = weld(limbs[1],char.Torso,limbs[1])
- rleg = weld(limbs[4],char.Torso,limbs[4])
- rarm = weld(limbs[3],char.Torso,limbs[3])
- larm = weld(limbs[2],char.Torso,limbs[2])
- leg1 = false
- leg2 = false
- game:GetService("RunService").Stepped:Connect(function()
- if leg1 == true then
- lerp(rleg,dummy5leg1)
- else
- lerp(rleg,dummy4leg1)
- end
- if leg2 == true then
- lerp(lleg,dummy4leg2)
- else
- lerp(lleg,dummy5leg2)
- end
- if d2 == true then
- lerp(rarm,dummy2arm1)
- lerp(larm,dummy2arm2)
- end
- if d3 == true then
- lerp(rarm,dummy3arm1)
- lerp(larm,dummy3arm2)
- end
- if d4 == true then
- lerp(larm,dummy4arm1)
- lerp(rarm,dummy4arm2)
- end
- if d5 == true then
- lerp(larm,dummy5arm1)
- lerp(rarm,dummy5arm2)
- end
- for i,v in pairs(distractedlist) do
- if v ~= nil then
- for i,limb in pairs(v:GetDescendants()) do
- if limb:FindFirstChild("distractionweld") then
- doh = limb:FindFirstChild("distractionweld")
- for i,limb2 in pairs(char:GetDescendants()) do
- if limb2.Name == doh.Parent.Name and limb2:FindFirstChild(doh.Name) then
- doh.C0 = limb2[doh.Name].C0
- end
- end
- end
- end
- end
- end
- end)
- mouse = owner:GetMouse()
- mouse.Button1Down:Connect(function()
- target = mouse.Target
- if target.Parent ~= nil and target.Parent ~= workspace and target.Parent:FindFirstChildOfClass("Humanoid") and target.Parent:FindFirstChildOfClass("Humanoid").Name ~= "dancedistraction" then
- distraction(target.Parent)
- end
- end)
- coroutine.resume(coroutine.create(function()
- while wait(0.20) do
- d2 = true
- d3 = false
- d4 = false
- d5 = false
- wait(0.20)
- d2 = false
- d3 = true
- d4 = false
- d5 = false
- wait(0.20)
- d2 = true
- d3 = false
- d4 = false
- d5 = false
- wait(0.38)
- d2 = false
- d3 = false
- d4 = true
- d5 = false
- wait(0.3)
- d2 = false
- d3 = false
- d4 = false
- d5 = true
- end
- end))
- coroutine.resume(coroutine.create(function()
- while wait(0.20) do
- leg1 = true
- leg2 = false
- wait(0.20)
- leg1 = false
- leg2 = true
- end
- end))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement