MW Fdless5
MW Fdless5
MW Fdless5
local healthHide = true --moves your head away every 3 seconds so players dont see
your health bar
local reclaim = true --if you lost control over a part this will move your primary
part to the part so you get it back
local novoid = true --prevents parts from going under
workspace.FallenPartsDestroyHeight if you control them
local discharscripts = true --disables all localScripts parented to your character
before reanimation
local R15toR6 = true --adds fake r6 parts and joints for animations if your
character is r15
local hatcollide = false --makes hats cancollide (credit to ShownApe) (only method
0)
local humState16 = true --enables collisions for limbs before the humanoid dies
(using hum:ChangeState)
local walkSpeed = 16 --ur walkspeed
local jumpPower = 50 --ur jump power
local gravity = 196.2 --how fast ur gonna be falling
local loadtime = game:GetService("Players").RespawnTime + 0.5 --anti respawn delay
local simrad = 1000 --sets simulation radius to this with sethiddenproperty (nil to
disable)
local method = 3 --reanimation method
--methods:
--0 - breakJoints (takes [loadtime] seconds to load)
--1 - limbs
--2 - limbs + anti respawn
--3 - limbs + breakJoints after [loadtime] seconds
--4 - remove humanoid + breakJoints
local flingpart = "HumanoidRootPart" --the name of the part or the hat used for
flinging
local maxflingtrsp = 0.5 --max transparency of the fling part (if its above this it
will be set to this)
--the fling function
--usage: fling(target, duration, velocity)
--target can be set to: basePart, CFrame, Vector3, character model or humanoid
(flings at mouse.Hit if argument not provided)
--duration (fling time in seconds) can be set to a number or a string convertable
to a number (0.5s if not provided)
--velocity (fling part rotation velocity) can be set to a vector3 value
(Vector3.new(20000, 20000, 20000) if not provided)
if hatcollide then
local any = c:FindFirstChildOfClass("BodyColors") or gp(c, "Health", "Script")
or gp(c, "Animate", "LocalScript")
if torso and rootpart and any then
torso:Destroy()
rootpart:Destroy()
any:Destroy()
end
c:BreakJoints()
end
local refreshjoints = nil
refreshjoints = function(part, refreshed)
refreshed = refreshed or {}
tinsert(refreshed, part)
for i, v in pairs(joints) do
if v.Part0 == part then
cframes[v.Part1] = cframes[part] * v.C0 * v.C1:Inverse()
if not tfind(refreshed, v.Part1) then
refreshjoints(v.Part1, refreshed)
end
elseif v.Part1 == part then
cframes[v.Part0] = cframes[part] * v.C1 * v.C0:Inverse()
if not tfind(refreshed, v.Part0) then
refreshjoints(v.Part0, refreshed)
end
end
end
end
if R15toR6 then
local R6parts = {
head = {Name = "Head", Anchored = true},
torso = {Name = "Torso", Anchored = true},
root = {Name = "HumanoidRootPart", Anchored = true},
leftArm = {Name = "Left Arm", Anchored = true},
rightArm = {Name = "Right Arm", Anchored = true},
leftLeg = {Name = "Left Leg", Anchored = true},
rightLeg = {Name = "Right Leg", Anchored = true}
}
for i, v in pairs(R6parts) do
cframes[v] = cfr
end
tinsert(joints, {
Name = "Neck",
Part0 = R6parts.torso,
Part1 = R6parts.head,
C0 = cf(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),
C1 = cf(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
})
tinsert(joints, {
Name = "RootJoint" ,
Part0 = R6parts.root,
Part1 = R6parts.torso,
C0 = cf(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),
C1 = cf(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
})
tinsert(joints, {
Name = "Right Shoulder",
Part0 = R6parts.torso,
Part1 = R6parts.rightArm,
C0 = cf(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0),
C1 = cf(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
})
tinsert(joints, {
Name = "Left Shoulder",
Part0 = R6parts.torso,
Part1 = R6parts.leftArm,
C0 = cf(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0),
C1 = cf(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
})
tinsert(joints, {
Name = "Right Hip",
Part0 = R6parts.torso,
Part1 = R6parts.rightLeg,
C0 = cf(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0),
C1 = cf(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
})
tinsert(joints, {
Name = "Left Hip" ,
Part0 = R6parts.torso,
Part1 = R6parts.leftLeg,
C0 = cf(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0),
C1 = cf(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
})
tinsert(joints, {
Part0 = R6parts.root,
Part1 = rootpart,
C0 = cf_0,
C1 = cf_0
})
refreshjoints(rootpart)
local function getpart(name)
for i, _ in pairs(cframes) do
if (i.Name == name) and (type(i) ~= "table") then
return i
end
end
return nil
end
local function makejoint(p0, p1, p2)
p1, p2 = getpart(p1), getpart(p2)
if not (p1 and p2) then return end
for i, v in pairs(joints) do
if (v.Part0 == p1) and (v.Part1 == p2) then
joints[i] = nil
elseif (v.Part0 == p2) and (v.Part1 == p1) then
joints[i] = nil
end
end
tinsert(joints, {
Part0 = p0,
Part1 = p1,
C0 = cf_0,
C1 = cframes[p1]:Inverse() * cframes[p0]
})
end
makejoint(R6parts.head, "Head", "UpperTorso")
makejoint(R6parts.leftArm, "LeftUpperArm", "UpperTorso")
makejoint(R6parts.rightArm, "RightUpperArm", "UpperTorso")
makejoint(R6parts.leftLeg, "LeftUpperLeg", "LowerTorso")
makejoint(R6parts.rightLeg, "RightUpperLeg", "LowerTorso")
makejoint(R6parts.torso, "LowerTorso", "HumanoidRootPart")
end
local legcfR, legcfL, legvec = cf(1, -1.5, 0), cf(-1, -1.5, 0), v3(0, -1.5, 0)
local function raycastlegs()
local rY, lY = ws:Raycast((cfr * legcfR).Position, legvec, raycastparams),
ws:Raycast((cfr * legcfL).Position, legvec, raycastparams)
return rY and (rY.Position.Y - (cfr.Y - 3)) or 0, lY and (lY.Position.Y -
(cfr.Y - 3)) or 0
end
sine = osclock()
local delta = sine - lastsine
deltaTime = clamp(delta * 10, 0, 1)
lastsine = sine
if onground then
if xzvel == v3_0 then
pose = "idle"
else
pose = "walk"
end
elseif Yvel > 0 then
pose = "jump"
else
pose = "fall"
end
local lerpfunc = modes[mode][pose]
if type(lerpfunc) ~= "function" then
lerpfunc = modes.default[pose]
end
if type(lerpfunc) == "function" then
lerpfunc()
end
cframes[rootpart] = cfr
refreshjoints(rootpart)
for i, v in pairs(cframes) do
if (not i.Anchored) and i:IsDescendantOf(ws) then
if i.ReceiveAge == 0 then
if (i == flingpart) and flingcf then
flingcf = flingcf * angles(0, flingvel.Unit.Y * -deltaTime, 0)
v = flingcf
i.RotVelocity = flingvel
else
i.RotVelocity = v3_0
end
local vel = (v.Position - lastpositions[i]) / delta
lastpositions[i] = v.Position
if vel.Magnitude < 0.15 then
v = v * idleoff
end
if (i == reclaim) and lostPart then
v = lostPart.CFrame
lostPart = nil
i.Velocity = v3_0
elseif healthHidden and (i == healthHide) then
v = v + v3_h
i.Velocity = getNetlessVelocity(v3_0)
else
i.Velocity = getNetlessVelocity(vel*noYvelTime + xzvel)
end
if novoid and (v.Y < novoid) then
v = v + v3_010 * (novoid - v.Y)
end
i.CFrame = v
else
lastpositions[i] = i.Position
if reclaim and (i ~= reclaim) then
lostPart = i
end
end
end
end
if simrad then
shp(lp, "SimulationRadius", simrad)
end
end
con = heartbeat:Connect(mainFunction)
mainFunction()
addmode("default", {
idle = function(deltaTime)
--default idle animation lerps here
end,
walk = function(deltaTime)
--default walk animation lerps here
end,
jump = function(deltaTime)
--default jump animation lerps here
end,
fell = function(deltaTime)
--default fell animation lerps here
end
})
--addmode("Q", {})
--addmode("E", {}) --for different modes