
KeylessUniversal

-- Made by @emperrrr (Discord)
-- Discord server: https://discord.gg/UJ7YtqadPJ
do
local Accessories = {}
local Aligns = {}
local Attachments = {}
local BindableEvent = nil
local Blacklist = {}
local CFrame = CFrame
local CFrameidentity = CFrame.identity
local CFramelookAt = CFrame.lookAt
local CFramenew = CFrame.new
local Character = nil
local CurrentCamera = nil
local Enum = Enum
local Custom = Enum.CameraType.Custom
local Health = Enum.CoreGuiType.Health
local HumanoidRigType = Enum.HumanoidRigType
local Dead = Enum.HumanoidStateType.Dead
local LockCenter = Enum.MouseBehavior.LockCenter
local MouseButton1 = Enum.UserInputType.MouseButton1
local game = game
local Clone = game.Clone
local Close = game.Close
local Connect = Close.Connect
local Disconnect = Connect(Close, function() end).Disconnect
local Wait = Close.Wait
local Destroy = game.Destroy
local FindFirstAncestorOfClass = game.FindFirstAncestorOfClass
local FindFirstChildOfClass = game.FindFirstChildOfClass
local Players = FindFirstChildOfClass(game, "Players")
local CreateHumanoidModelFromDescription = Players.CreateHumanoidModelFromDescription
local GetPlayers = Players.GetPlayers
local LocalPlayer = Players.LocalPlayer
local CharacterAdded = LocalPlayer.CharacterAdded
local ConnectDiedSignalBackend = LocalPlayer.ConnectDiedSignalBackend
local Mouse = LocalPlayer:GetMouse()
local Kill = LocalPlayer.Kill
local RunService = FindFirstChildOfClass(game, "RunService")
local PostSimulation = RunService.PostSimulation
local PreRender = RunService.PreRender
local PreSimulation = RunService.PreSimulation
local StarterGui = FindFirstChildOfClass(game, "StarterGui")
local GetCoreGuiEnabled = StarterGui.GetCoreGuiEnabled
local SetCore = StarterGui.SetCore
local SetCoreGuiEnabled = StarterGui.SetCoreGuiEnabled
local Workspace = FindFirstChildOfClass(game, "Workspace")
local FallenPartsDestroyHeight = Workspace.FallenPartsDestroyHeight
local FindFirstChildWhichIsA = game.FindFirstChildWhichIsA
local UserInputService = FindFirstChildOfClass(game, "UserInputService")
local InputBegan = UserInputService.InputBegan
local GetChildren = game.GetChildren
local GetDescendants = game.GetDescendants
local GetPropertyChangedSignal = game.GetPropertyChangedSignal
local CurrentCameraChanged = GetPropertyChangedSignal(Workspace, "CurrentCamera")
local MouseBehaviorChanged = GetPropertyChangedSignal(UserInputService, "MouseBehavior")
local IsA = game.IsA
local IsDescendantOf = game.IsDescendantOf
local Instancenew = Instance.new
local HumanoidDescription = Instancenew("HumanoidDescription")
local HumanoidModel = CreateHumanoidModelFromDescription(Players, HumanoidDescription, HumanoidRigType.R6)
local R15HumanoidModel = CreateHumanoidModelFromDescription(Players, HumanoidDescription, HumanoidRigType.R15)
local SetAccessories = HumanoidDescription.SetAccessories
local ModelBreakJoints = HumanoidModel.BreakJoints
local Head = HumanoidModel.Head
local BasePartBreakJoints = Head.BreakJoints
local GetJoints = Head.GetJoints
local IsGrounded = Head.IsGrounded
local Humanoid = HumanoidModel.Humanoid
local ApplyDescription = Humanoid.ApplyDescription
local ChangeState = Humanoid.ChangeState
local GetAppliedDescription = Humanoid.GetAppliedDescription
local Move = Humanoid.Move
local ScaleTo = HumanoidModel.ScaleTo
local IsFirst = false
local IsHealthEnabled = nil
local IsLockCenter = false
local IsRegistered = false
local IsRunning = false
local LastTime = nil
local math = math
local mathrandom = math.random
local mathsin = math.sin
local next = next
local OptionsAccessories = nil
local OptionsApplyDescription = nil
local OptionsBreakJointsDelay = nil
local OptionsChangePrimaryPart = nil
local OptionsClickFling = nil
local OptionsDisableHealthBar = nil
local OptionsParentCharacter = nil
local OptionsPermanentDeath = nil
local OptionsRefit = nil
local OptionsRigTransparency = nil
local OptionsSetCameraSubject = nil
local OptionsSetCameraType = nil
local OptionsSetCharacter = nil
local OptionsSetCollisionGroup = nil
local OptionsSimulationRadius = nil
local OptionsTeleportRadius = nil
local osclock = os.clock
local PreRenderConnection = nil
local RBXScriptConnections = {}
local Refitting = false
local replicatesignal = replicatesignal
local Rig = nil
local RigHumanoid = nil
local RigHumanoidRootPart = nil
local stringfind = string.find
local table = table
local tableclear = table.clear
local tablefind = table.find
local tableinsert = table.insert
local tableremove = table.remove
local Targets = {}
local task = task
local taskdefer = task.defer
local taskspawn = task.spawn
local taskwait = task.wait
local Time = nil
local Vector3 = Vector3
local Vector3new = Vector3.new
local FlingVelocity = Vector3new(16384, 16384)
local Vector3xzAxis = Vector3new(1, 0, 1)
local Vector3zero = Vector3.zero
Humanoid = nil
Destroy(HumanoidDescription)
HumanoidDescription = nil
local FindFirstChildOfClassAndName = function(Parent, ClassName, Name)
for Index, Child in next, GetChildren(Parent) do
if IsA(Child, ClassName) and Child.Name == Name then
return Child
end
end
end
local DescendantAdded = function(Descendant)
if IsA(Descendant, "Attachment") then
local Attachment = Attachments[Descendant.Name]
if Attachment then
local Parent = Descendant.Parent
if IsA(Parent, "BasePart") then
local MeshId = nil
local TextureId = nil
if IsA(Parent, "MeshPart") then
MeshId = Parent.MeshId
TextureId = Parent.TextureID
else
local SpecialMesh = FindFirstChildOfClass(Parent, "SpecialMesh")
if SpecialMesh then
MeshId = SpecialMesh.MeshId
TextureId = SpecialMesh.TextureId
end
end
if MeshId then
for Index, Table in next, OptionsAccessories do
if stringfind(MeshId, Table.MeshId) and stringfind(TextureId, Table.TextureId) then
local Instance = nil
local TableName = Table.Name
local TableNames = Table.Names
if TableName then
Instance = FindFirstChildOfClassAndName(Rig, "BasePart", TableName)
else
for Index, TableName in next, TableNames do
local Child = FindFirstChildOfClassAndName(Rig, "BasePart", TableName)
if not ( TableNames[Index + 1] and Blacklist[Child] ) then
Instance = Child
break
end
end
end
if Instance then
local Blacklisted = Blacklist[Instance]
if not ( Blacklisted and Blacklisted.MeshId == MeshId and Blacklisted.TextureId == TextureId ) then
tableinsert(Aligns, {
LastPosition = Instance.Position,
Offset = Table.Offset,
Part0 = Parent,
Part1 = Instance
})
Blacklist[Instance] = { MeshId = MeshId, TextureId = TextureId }
return
end
end
end
end
for Index, Table in next, Accessories do
if Table.MeshId == MeshId and Table.TextureId == TextureId then
local Handle = Table.Handle
tableinsert(Aligns, {
LastPosition = Handle.Position,
Offset = CFrameidentity,
Part0 = Parent,
Part1 = Handle
})
return
end
end
local Accoutrement = Parent.Parent
if IsA(Accoutrement, "Accoutrement") then
local AccoutrementClone = Clone(Accoutrement)
local HandleClone = FindFirstChildOfClassAndName(AccoutrementClone, "BasePart", "Handle")
HandleClone.Transparency = OptionsRigTransparency
for Index, Descendant in next, GetDescendants(HandleClone) do
if IsA(Descendant, "JointInstance") then
Destroy(Descendant)
end
end
local AccessoryWeld = Instancenew("Weld")
AccessoryWeld.C0 = Descendant.CFrame
AccessoryWeld.C1 = Attachment.CFrame
AccessoryWeld.Name = "AccessoryWeld"
AccessoryWeld.Part0 = HandleClone
AccessoryWeld.Part1 = Attachment.Parent
AccessoryWeld.Parent = HandleClone
AccoutrementClone.Parent = Rig
tableinsert(Accessories, {
Handle = HandleClone,
MeshId = MeshId,
TextureId = TextureId
})
tableinsert(Aligns, {
LastPosition = HandleClone.Position,
Offset = CFrameidentity,
Part0 = Parent,
Part1 = HandleClone
})
end
end
end
end
end
end
local SetCameraSubject = function()
local CameraCFrame = CurrentCamera.CFrame
local Position = RigHumanoidRootPart.CFrame.Position
CurrentCamera.CameraSubject = RigHumanoid
Wait(PreRender)
CurrentCamera.CFrame = CameraCFrame + RigHumanoidRootPart.CFrame.Position - Position
end
local OnCameraSubjectChanged = function()
if CurrentCamera.CameraSubject ~= RigHumanoid then
taskdefer(SetCameraSubject)
end
end
local OnCameraTypeChanged = function()
if CurrentCamera.CameraType ~= Custom then
CurrentCamera.CameraType = Custom
end
end
local OnCurrentCameraChanged = function()
local Camera = Workspace.CurrentCamera
if Camera and OptionsSetCameraSubject then
CurrentCamera = Workspace.CurrentCamera
taskspawn(SetCameraSubject)
OnCameraSubjectChanged()
tableinsert(RBXScriptConnections, Connect(GetPropertyChangedSignal(CurrentCamera, "CameraSubject"), OnCameraSubjectChanged))
if OptionsSetCameraType then
OnCameraTypeChanged()
tableinsert(RBXScriptConnections, Connect(GetPropertyChangedSignal(CurrentCamera, "CameraType"), OnCameraTypeChanged))
end
end
end
local SetCharacter = function()
LocalPlayer.Character = Rig
end
local SetSimulationRadius = function()
LocalPlayer.SimulationRadius = OptionsSimulationRadius
end
local WaitForChildOfClass = function(Parent, ClassName)
local Child = FindFirstChildOfClass(Parent, ClassName)
while not Child do
Wait(Parent.ChildAdded)
Child = FindFirstChildOfClass(Parent, ClassName)
end
return Child
end
local WaitForChildOfClassAndName = function(Parent, ...)
local Child = FindFirstChildOfClassAndName(Parent, ...)
while not Child do
Wait(Parent.ChildAdded)
Child = FindFirstChildOfClassAndName(Parent, ...)
end
return Child
end
local Fling = function(Target, Options)
if Target then
local Highlight = Options.Highlight
if IsA(Target, "Humanoid") then
Target = Target.Parent
end
if IsA(Target, "Model") then
Target = FindFirstChildOfClassAndName(Target, "BasePart", "HumanoidRootPart") or FindFirstChildWhichIsA(Character, "BasePart")
end
if not tablefind(Targets, Target) and IsA(Target, "BasePart") and not Target.Anchored and not IsDescendantOf(Character, Target) and not IsDescendantOf(Rig, Target) then
local Model = FindFirstAncestorOfClass(Target, "Model")
if Model and FindFirstChildOfClass(Model, "Humanoid") then
Target = FindFirstChildOfClassAndName(Model, "BasePart", "HumanoidRootPart") or FindFirstChildWhichIsA(Character, "BasePart") or Target
else
Model = Target
end
if Highlight then
local HighlightObject = type(Highlight) == "boolean" and Instancenew("Highlight") or Clone(Highlight)
HighlightObject.Adornee = Model
HighlightObject.Parent = Model
Options.HighlightObject = HighlightObject
end
Targets[Target] = Options
end
end
end
local OnCharacterAdded = function(NewCharacter)
if NewCharacter ~= Rig then
tableclear(Aligns)
tableclear(Blacklist)
Character = NewCharacter
if OptionsSetCameraSubject then
taskspawn(SetCameraSubject)
end
if OptionsSetCharacter then
taskdefer(SetCharacter)
end
if OptionsParentCharacter then
Character.Parent = Rig
end
for Index, Descendant in next, GetDescendants(Character) do
DescendantAdded(Descendant)
end
tableinsert(RBXScriptConnections, Connect(Character.DescendantAdded, DescendantAdded))
Humanoid = WaitForChildOfClass(Character, "Humanoid")
local HumanoidRootPart = WaitForChildOfClassAndName(Character, "BasePart", "HumanoidRootPart")
if IsFirst then
if OptionsApplyDescription and Humanoid then
local AppliedDescription = GetAppliedDescription(Humanoid)
SetAccessories(AppliedDescription, {}, true)
ApplyDescription(RigHumanoid, AppliedDescription)
end
if HumanoidRootPart then
RigHumanoidRootPart.CFrame = HumanoidRootPart.CFrame
if OptionsSetCollisionGroup then
local CollisionGroup = HumanoidRootPart.CollisionGroup
for Index, Descendant in next, GetDescendants(Rig) do
if IsA(Descendant, "BasePart") then
Descendant.CollisionGroup = CollisionGroup
end
end
end
end
IsFirst = false
end
if HumanoidRootPart then
for Target, Options in next, Targets do
if IsDescendantOf(Target, Workspace) then
local FirstPosition = Target.Position
local PredictionFling = Options.PredictionFling
local LastPosition = FirstPosition
local Timeout = osclock() + 1
while IsDescendantOf(Target, Workspace) and osclock() < Timeout do
local DeltaTime = taskwait()
local Position = Target.Position
if ( Position - FirstPosition ).Magnitude > 100 then
break
end
local Offset = Vector3zero
if PredictionFling then
Vector3zero = ( Position - LastPosition ) / DeltaTime * 0.13
end
HumanoidRootPart.AssemblyAngularVelocity = FlingVelocity
HumanoidRootPart.AssemblyLinearVelocity = FlingVelocity
HumanoidRootPart.CFrame = Target.CFrame + Offset
LastPosition = Position
end
end
local HighlightObject = Options.HighlightObject
if HighlightObject then
Destroy(HighlightObject)
end
Targets[Target] = nil
end
HumanoidRootPart.AssemblyAngularVelocity = Vector3zero
HumanoidRootPart.AssemblyLinearVelocity = Vector3zero
if OptionsChangePrimaryPart then
local RootPartCFrame = RigHumanoidRootPart.CFrame
HumanoidRootPart.CFrame = CFramenew(RootPartCFrame.X, FallenPartsDestroyHeight + 20 * ( 1 + OptionsBreakJointsDelay ) + ( OptionsSetCharacter and 225 or 0 ), RootPartCFrame.Z) * CFrame.Angles(1.57, 0, 0)
elseif OptionsTeleportRadius then
HumanoidRootPart.CFrame = RigHumanoidRootPart.CFrame + Vector3new(mathrandom(- OptionsTeleportRadius, OptionsTeleportRadius), 0, mathrandom(- OptionsTeleportRadius, OptionsTeleportRadius))
end
end
if OptionsPermanentDeath and replicatesignal then
replicatesignal(ConnectDiedSignalBackend)
taskwait(Players.RespawnTime)
taskwait(0.1)
replicatesignal(Kill)
Refitting = false
else
taskwait(OptionsBreakJointsDelay)
ModelBreakJoints(Character)
if Humanoid then
ChangeState(Humanoid, Dead)
end
end
end
end
local OnInputBegan = function(InputObject)
if InputObject.UserInputType == MouseButton1 then
Fling(Mouse.Target, {
Highlight = true,
PredictionFling = true
})
end
end
local OnPostSimulation = function()
Time = osclock()
local DeltaTime = Time - LastTime
LastTime = Time
if not OptionsSetCharacter and IsLockCenter then
local Position = RigHumanoidRootPart.Position
RigHumanoidRootPart.CFrame = CFramelookAt(Position, Position + CurrentCamera.CFrame.LookVector * Vector3xzAxis)
end
if OptionsSimulationRadius then
pcall(SetSimulationRadius)
end
local AntiSleep = Vector3new(mathsin(Time * 15), 0, 0) * 0.0015
local Axis = 27 + mathsin(Time)
for Index, Table in next, Aligns do
local Part0 = Table.Part0
if Part0.ReceiveAge == 0 then
if Table.IsLoaded and IsDescendantOf(Part0, Workspace) and not GetJoints(Part0)[1] and not IsGrounded(Part0) then
Table.IsLoaded2 = true
local Part1 = Table.Part1
Part0.AssemblyAngularVelocity = Vector3zero
local Position = Part1.Position
local LinearVelocity = ( Position - Table.LastPosition ) / DeltaTime * Axis
Part0.AssemblyLinearVelocity = Vector3new(LinearVelocity.X, Axis, LinearVelocity.Z)
Table.LastPosition = Position
Part0.CFrame = Part1.CFrame * Table.Offset + AntiSleep
end
elseif not Table.IsLoaded then
Table.IsLoaded = true
elseif Table.IsLoaded2 and OptionsPermanentDeath and OptionsRefit and replicatesignal then
Refitting = false
replicatesignal(ConnectDiedSignalBackend)
end
end
if not OptionsSetCharacter and Humanoid then
Move(RigHumanoid, Humanoid.MoveDirection)
RigHumanoid.Jump = Humanoid.Jump
end
if IsRegistered then
SetCore(StarterGui, "ResetButtonCallback", BindableEvent)
else
IsRegistered = pcall(SetCore, StarterGui, "ResetButtonCallback", BindableEvent)
end
end
local OnPreRender = function()
local Position = RigHumanoidRootPart.Position
RigHumanoidRootPart.CFrame = CFramelookAt(Position, Position + CurrentCamera.CFrame.LookVector * Vector3xzAxis)
for Index, Table in next, Aligns do
local Part0 = Table.Part0
if Table.IsLoaded and Part0.ReceiveAge == 0 and not GetJoints(Part0)[1] and not IsGrounded(Part0) then
Part0.CFrame = Table.Part1.CFrame * Table.Offset
end
end
end
local OnMouseBehaviorChanged = function()
IsLockCenter = UserInputService.MouseBehavior == LockCenter
if IsLockCenter then
PreRenderConnection = Connect(PreRender, OnPreRender)
tableinsert(RBXScriptConnections, PreRenderConnection)
elseif PreRenderConnection then
Disconnect(PreRenderConnection)
tableremove(RBXScriptConnections, tablefind(RBXScriptConnections, PreRenderConnection))
end
end
local OnPreSimulation = function()
if Character then
for Index, Descendant in next, GetDescendants(Character) do
if IsA(Descendant, "BasePart") then
Descendant.CanCollide = false
end
end
end
end
Start = function(Options)
if not IsRunning then
IsFirst = true
IsRunning = true
Options = Options or {}
OptionsAccessories = Options.Accessories or {}
OptionsApplyDescription = Options.ApplyDescription
OptionsBreakJointsDelay = Options.BreakJointsDelay or 0
OptionsChangePrimaryPart = Options.ChangePrimaryPart
OptionsClickFling = Options.ClickFling
OptionsDisableHealthBar = Options.DisableHealthBar
OptionsParentCharacter = Options.ParentCharacter
OptionsPermanentDeath = Options.PermanentDeath
OptionsRefit = Options.Refit
local OptionsRigSize = Options.RigSize
OptionsRigTransparency = Options.RigTransparency or 1
OptionsSetCameraSubject = Options.SetCameraSubject
OptionsSetCameraType = Options.SetCameraType
OptionsSetCharacter = Options.SetCharacter
OptionsSetCollisionGroup = Options.SetCollisionGroup
OptionsSimulationRadius = Options.SimulationRadius
OptionsTeleportRadius = Options.TeleportRadius
if OptionsDisableHealthBar then
IsHealthEnabled = GetCoreGuiEnabled(StarterGui, Health)
SetCoreGuiEnabled(StarterGui, Health, false)
end
BindableEvent = Instancenew("BindableEvent")
tableinsert(RBXScriptConnections, Connect(BindableEvent.Event, Stop))
Rig = Options.R15 and Clone(R15HumanoidModel) or Clone(HumanoidModel)
Rig.Name = LocalPlayer.Name
RigHumanoid = Rig.Humanoid
RigHumanoidRootPart = Rig.HumanoidRootPart
Rig.Parent = Workspace
for Index, Descendant in next, GetDescendants(Rig) do
if IsA(Descendant, "Attachment") then
Attachments[Descendant.Name] = Descendant
elseif IsA(Descendant, "BasePart") or IsA(Descendant, "Decal") then
Descendant.Transparency = OptionsRigTransparency
end
end
if OptionsRigSize then
ScaleTo(Rig, OptionsRigSize)
RigHumanoid.JumpPower = 50
RigHumanoid.WalkSpeed = 16
end
OnCurrentCameraChanged()
tableinsert(RBXScriptConnections, Connect(CurrentCameraChanged, OnCurrentCameraChanged))
if OptionsClickFling then
tableinseNo comments yet for this script.



