wait()
local player = owner
print([[
Made by Protofer_S
Z: attacking
X: become ghost again (only works when taking over a body)
M: Escape body (destroys body)
ofc uploaded on glot.io by oleggolovanov01alt
]])
function localscript()
NLS([[local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local remote = player.Backpack:WaitForChild'grab'
local rem = player.Backpack:WaitForChild'reghost'
local rem1 = player.Backpack:WaitForChild('Ghost')
mouse.KeyDown:Connect(function(kk)
kk:lower()
if kk=="z" then
remote:FireServer('yes')
end
end)
mouse.KeyDown:Connect(function(kk)
kk:lower()
if kk=="x" then
rem:FireServer('yes')
end
end)
mouse.KeyDown:Connect(function(kk)
kk:lower()
if kk=="m" then
rem1:FireServer('yes')
end
end)]],player.Backpack)
end
function camera()
NLS([[local player = game.Players.LocalPlayer
local cam = workspace.CurrentCamera
cam.CameraSubject=player.Character:FindFirstChildOfClass'Humanoid']],player.Backpack)
end
function animation(und)
local Figure=und
wait(.5)
local Humanoid = und:FindFirstChildOfClass('Humanoid')
if Humanoid then
local displayname = ' '--und.Name..'?'
if Humanoid.WalkSpeed<5 then
Humanoid.WalkSpeed=16
end
local Torso = und:WaitForChild'Torso'
--making the joints (dont worry, i also dont know how joints work)
function waitForChild(parent, childName)
local child = parent:findFirstChild(childName)
if child then return child end
while true do
child = parent.ChildAdded:wait()
if child.Name==childName then return child end
end
end
wait()
function makeJoint(limbName, jointName, c0, c1)
local limb = waitForChild(Figure, limbName)
if limb.Name=='Head' then
else
limb:BreakJoints()
end
local joint = Instance.new"Motor6D"
joint.Name = jointName
joint.Part0 = Torso
joint.Part1 = limb
joint.C0 = c0
joint.C1 = c1
joint.MaxVelocity = 0.5
joint.archivable = true
joint.Parent = Torso
return joint
end
local Neck = makeJoint("Head","Neck", CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0), CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0))
local RightShoulder = makeJoint("Right Arm", "Right Shoulder", CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0))
local LeftShoulder = makeJoint("Left Arm", "Left Shoulder", CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0))
local RightHip = makeJoint("Right Leg", "Right Hip", CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0))
local LeftHip = makeJoint("Left Leg", "Left Hip", CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0))
-- util
function waitForChild(parent, childName)
while true do
local child = parent:findFirstChild(childName)
if child then
return child
end
parent.ChildAdded:wait()
end
end
-- declarations
--local Figure = owner.Character
--local Torso = waitForChild(Figure, "Torso")
--local Humanoid = waitForChild(Figure, "Humanoid")
--local RightShoulder = waitForChild(Torso, "Right Shoulder")
--local LeftShoulder = waitForChild(Torso, "Left Shoulder")
--local RightHip = waitForChild(Torso, "Right Hip")
--local LeftHip = waitForChild(Torso, "Left Hip")
--local Neck = waitForChild(Torso, "Neck")
-- functions
local toolAnim = "None"
local toolAnimTime = 0
-- functions
function onRunning(speed)
if speed>0 then
pose = "Running"
else
pose = "Standing"
end
end
function onDied()
pose = "Dead"
end
function onJumping(state)
pose = "Jumping"
end
function onClimbing()
pose = "Climbing"
end
function onGettingUp(state)
pose = "GettingUp"
end
function onFreeFall(state)
pose = "FreeFall"
end
function onFallingDown(state)
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function moveJump()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
-- same as jump for now
function moveFreeFall()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle = 3.14 /2
LeftShoulder.DesiredAngle = -3.14 /2
RightHip.DesiredAngle = 3.14 /2
LeftHip.DesiredAngle = -3.14 /2
end
local function getTool()
for i, v in ipairs(Figure:GetChildren()) do
if v:IsA"Tool" then
return v
end
end
return nil
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
RightShoulder.DesiredAngle = 1.57
return
end
if (toolAnim == "Slash") then
RightShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 0
return
end
if (toolAnim == "Lunge") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightHip.MaxVelocity = 0.5
LeftHip.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 1.57
LeftShoulder.DesiredAngle = 1.0
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 1.0
return
end
end
function move(time)
local amplitude
local frequency
if (pose == "Jumping") then
moveJump()
return
end
if (pose == "FreeFall") then
moveFreeFall()
return
end
if (pose == "Seated") then
moveSit()
return
end
local climbFudge = 0
if (pose == "Running") then
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
amplitude = 1
frequency = 9
elseif (pose == "Climbing") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
amplitude = 1
frequency = 9
climbFudge = 3.14
else
amplitude = 0.1
frequency = 1
end
desiredAngle = amplitude * math.sin(time*frequency)
RightShoulder.DesiredAngle = desiredAngle + climbFudge
LeftShoulder.DesiredAngle = desiredAngle - climbFudge
RightHip.DesiredAngle = -desiredAngle
LeftHip.DesiredAngle = -desiredAngle
local tool = getTool()
if tool then
animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
toolAnim = "None"
toolAnimTime = 0
end
end
-- connect events
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(onJumping)
Humanoid.Climbing:connect(onClimbing)
Humanoid.GettingUp:connect(onGettingUp)
Humanoid.FreeFalling:connect(onFreeFall)
Humanoid.FallingDown:connect(onFallingDown)
Humanoid.Seated:connect(onSeated)
-- main program
local runService = game:service("RunService");
runService.Heartbeat:Connect(function()
if Figure.Parent~=nil then
local _, time = wait(0.01)
move(time)
end
end)
--while Figure.Parent~=nil do
-- local _, time = wait(0.1)
-- move(time)
--end
else
print('no')
end
function dead(position)
local und = Instance.new("Model",workspace) und.Name=" "
und.Archivable=true
local Torso = Instance.new("Part",und) Torso.Name="Torso" Torso.Size=Vector3.new(2,2,1) Torso.Color=Color3.new()
local Head = Instance.new("Part",und) Head.Size=Vector3.new(2,1,1) Head.Name="Head" Head.Color=Color3.new()
local mesh = Instance.new("SpecialMesh",Head) mesh.MeshId="rbxassetid://6741699892" mesh.Scale = Vector3.new(0.025, 0.025, 0.025)
local rightarm = Instance.new("Part",und) rightarm.Size=Vector3.new(1,2,1) rightarm.Name="Right Arm" rightarm.Color=Color3.new()
local leftarm = Instance.new("Part",und) leftarm.Size=Vector3.new(1,2,1) leftarm.Name="Left Arm" leftarm.Color=Color3.new()
local leftleg = Instance.new("Part",und) leftleg.Size=Vector3.new(1,2,1) leftleg.Name="Left Leg" leftleg.Color=Color3.new()
local rightleg = Instance.new("Part",und) rightleg.Size=Vector3.new(1,2,1) rightleg.Name="Right Leg" rightleg.Color=Color3.new()
local root = Instance.new("Part",und) root.Size=Torso.Size root.Transparency=1 root.Name='HumanoidRootPart'root.CFrame=position local rootjoint = Instance.new("Motor6D",root) rootjoint.Name='RootJoint' rootjoint.Part0=root rootjoint.Part1=Torso
local Humanoid = Instance.new("Humanoid",und) Humanoid.MaxHealth=9e9 Humanoid.Health=Humanoid.MaxHealth Humanoid.HealthDisplayDistance=Enum.HumanoidHealthDisplayType.AlwaysOff
Instance.new("Animator",Humanoid).Name="Animator" Humanoid.BreakJointsOnDeath=false Humanoid.RequiresNeck=false
local Figure=und
player.Character=und
--making the joints (dont worry, i also dont know how joints work)
function waitForChild(parent, childName)
local child = parent:findFirstChild(childName)
if child then return child end
while true do
child = parent.ChildAdded:wait()
if child.Name==childName then return child end
end
end
Ghost()
function makeJoint(limbName, jointName, c0, c1)
local limb = waitForChild(Figure, limbName)
if limb.Name=='Head' then
else
limb:BreakJoints()
end
local joint = Instance.new"Motor6D"
joint.Name = jointName
joint.Part0 = Torso
joint.Part1 = limb
joint.C0 = c0
joint.C1 = c1
joint.MaxVelocity = 0.5
joint.archivable = true
joint.Parent = Torso
return joint
end
local Neck = makeJoint("Head","Neck", CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0), CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0))
local RightShoulder = makeJoint("Right Arm", "Right Shoulder", CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0))
local LeftShoulder = makeJoint("Left Arm", "Left Shoulder", CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0))
local RightHip = makeJoint("Right Leg", "Right Hip", CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0))
local LeftHip = makeJoint("Left Leg", "Left Hip", CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0))
-- util
function waitForChild(parent, childName)
while true do
local child = parent:findFirstChild(childName)
if child then
return child
end
parent.ChildAdded:wait()
end
end
-- declarations
--local Figure = owner.Character
--local Torso = waitForChild(Figure, "Torso")
--local Humanoid = waitForChild(Figure, "Humanoid")
--local RightShoulder = waitForChild(Torso, "Right Shoulder")
--local LeftShoulder = waitForChild(Torso, "Left Shoulder")
--local RightHip = waitForChild(Torso, "Right Hip")
--local LeftHip = waitForChild(Torso, "Left Hip")
--local Neck = waitForChild(Torso, "Neck")
-- functions
local toolAnim = "None"
local toolAnimTime = 0
-- functions
function onRunning(speed)
if speed>0 then
pose = "Running"
else
pose = "Standing"
end
end
function onDied()
pose = "Dead"
end
function onJumping(state)
pose = "Jumping"
end
function onClimbing()
pose = "Climbing"
end
function onGettingUp(state)
pose = "GettingUp"
end
function onFreeFall(state)
pose = "FreeFall"
end
function onFallingDown(state)
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function moveJump()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
-- same as jump for now
function moveFreeFall()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle = 3.14 /2
LeftShoulder.DesiredAngle = -3.14 /2
RightHip.DesiredAngle = 3.14 /2
LeftHip.DesiredAngle = -3.14 /2
end
local function getTool()
for i, v in ipairs(Figure:GetChildren()) do
if v:IsA"Tool" then
return v
end
end
return nil
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
RightShoulder.DesiredAngle = 1.57
return
end
if (toolAnim == "Slash") then
RightShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 0
return
end
if (toolAnim == "Lunge") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightHip.MaxVelocity = 0.5
LeftHip.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 1.57
LeftShoulder.DesiredAngle = 1.0
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 1.0
return
end
end
function move(time)
local amplitude
local frequency
if (pose == "Jumping") then
moveJump()
return
end
if (pose == "FreeFall") then
moveFreeFall()
return
end
if (pose == "Seated") then
moveSit()
return
end
local climbFudge = 0
if (pose == "Running") then
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
amplitude = 1
frequency = 9
elseif (pose == "Climbing") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
amplitude = 1
frequency = 9
climbFudge = 3.14
else
amplitude = 0.1
frequency = 1
end
desiredAngle = amplitude * math.sin(time*frequency)
RightShoulder.DesiredAngle = desiredAngle + climbFudge
LeftShoulder.DesiredAngle = desiredAngle - climbFudge
RightHip.DesiredAngle = -desiredAngle
LeftHip.DesiredAngle = -desiredAngle
local tool = getTool()
if tool then
animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
toolAnim = "None"
toolAnimTime = 0
end
end
-- connect events
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(onJumping)
Humanoid.Climbing:connect(onClimbing)
Humanoid.GettingUp:connect(onGettingUp)
Humanoid.FreeFalling:connect(onFreeFall)
Humanoid.FallingDown:connect(onFallingDown)
Humanoid.Seated:connect(onSeated)
-- main program
local fakeface = Instance.new('Decal',Head) fakeface.Name='face'
local runService = game:service("RunService");
runService.Heartbeat:Connect(function()
if Figure.Parent~=nil then
local _, time = wait(0.05)
move(time)
end
end)
-- main program
end
end
function fakechar(victim)
victim.Archivable=true
print(victim.Name)
local display = ' '--victim.Name..'?'
local fakemodel = Instance.new("Model",workspace) fakemodel.Name='Ghost'
fakemodel.Archivable=true
local huma = victim:FindFirstChildOfClass('Humanoid')
huma.Parent=nil
local rig = huma.RigType
if huma.Health<5 then
print('dead')
huma=nil
fakemodel:Destroy()
fakemodel = Instance.new("Model",workspace) fakemodel.Name='Ghost'
huma = Instance.new("Humanoid",victim) huma.DisplayName=display huma.MaxHealth=9e9 huma.Health=9e9 huma.RigType=rig
local an = Instance.new('Animator',huma) an.Name='Animator' huma.Parent=fakemodel
else
print('yes')
local hum = huma:Clone() hum.DisplayName=display hum.MaxHealth=9e9 hum.Health=hum.MaxHealth hum.RequiresNeck=false hum.RigType=rig hum.Parent=fakemodel
local an = Instance.new('Animator',hum) an.Name='Animator'
end
for i,v in pairs(victim:GetDescendants()) do
if v:IsA("BasePart") then
if v.Name=='Handle' then
else
local child = v:GetChildren()
v.Parent=fakemodel
child.Parent=v
v.Anchored=false
end
end
end
for i,v in pairs(victim:GetDescendants()) do
if v:IsA("Accessory") then
v.Parent=fakemodel
end
end
for i,v in pairs(victim:GetDescendants()) do
if v:IsA("CharacterMesh") then
v.Parent=fakemodel
end
end
local shirt = victim:FindFirstChildOfClass('Shirt')
if shirt then
shirt.Parent=fakemodel
end
local pant = victim:FindFirstChildOfClass('Pants')
if pant then
pant.Parent=fakemodel
end
player.Character=fakemodel
for i,v in pairs(victim:GetDescendants()) do
if v:IsA("Script") then
if v.Name=='Animate' then
v.Disabled=true
v.Parent=fakemodel
v.Disabled=false
else
if v.Name=='Sound' then
v.Disabled=true
v.Parent=fakemodel
v.Disabled=false
else
v.Disabled=true
end
end
end
end
for i,v in pairs(victim:GetDescendants()) do
if v:IsA("LocalScript") then
if v.Name=='Animate' then
v.Disabled=false
v.Parent=player.Character
else
--v.Disabled=true
end
end
end
wait()
local r15yes = fakemodel:FindFirstChild('UpperTorso')
if r15yes then
else
print('animation loading')
animation(fakemodel)
end
camera()
localscript()
local normalchar = fakemodel:FindFirstChild('HumanoidRootPart')
if normalchar then
local findroot = normalchar:FindFirstChildOfClass('Motor6D')
if findroot then
else
local joint = Instance.new("Motor6D",normalchar)
local TOrrso = fakemodel:FindFirstChild('Torso')
if TOrrso then
joint.Part0=normalchar joint.Part1=normalchar joint.Name='RootJoint'
end
end
end
wait(1)
print('Loaded')
print('You have taken over '..victim.Name)
--fakemodel.Archivable=true
local victimplayer = game.Players:GetPlayerFromCharacter(victim)
if not victimplayer then victim.Parent=nil return end
print('killed player '..victimplayer.Name)
victimplayer:LoadCharacter()
wait()
end
function dead(position)
local und = Instance.new("Model",workspace) und.Name=" "
local Torso = Instance.new("Part",und) Torso.Name="Torso" Torso.Size=Vector3.new(2,2,1) Torso.Color=Color3.new() Torso.Transparency=.5
local Head = Instance.new("Part",und) Head.Size=Vector3.new(2,1,1) Head.Name="Head" Head.Color=Color3.new() Head.Transparency=.6
local mesh = Instance.new("SpecialMesh",Head) mesh.MeshId="rbxassetid://6741699892" mesh.Scale = Vector3.new(0.025, 0.025, 0.025)
local rightarm = Instance.new("Part",und) rightarm.Size=Vector3.new(1,2,1) rightarm.Name="Right Arm" rightarm.Color=Color3.new() rightarm.Transparency=.5
local leftarm = Instance.new("Part",und) leftarm.Size=Vector3.new(1,2,1) leftarm.Name="Left Arm" leftarm.Color=Color3.new() leftarm.Transparency=.5
local leftleg = Instance.new("Part",und) leftleg.Size=Vector3.new(1,2,1) leftleg.Name="Left Leg" leftleg.Color=Color3.new() leftleg.Transparency=.5
local rightleg = Instance.new("Part",und) rightleg.Size=Vector3.new(1,2,1) rightleg.Name="Right Leg" rightleg.Color=Color3.new() rightleg.Transparency=.5
local root = Instance.new("Part",und) root.Size=Torso.Size root.Transparency=1 root.Name='HumanoidRootPart'root.CFrame=position local rootjoint = Instance.new("Motor6D",root) rootjoint.Name='RootJoint' rootjoint.Part0=root rootjoint.Part1=Torso
local Humanoid = Instance.new("Humanoid",und) Humanoid.MaxHealth=9e9 Humanoid.Health=Humanoid.MaxHealth Humanoid.HealthDisplayDistance=Enum.HumanoidHealthDisplayType.AlwaysOff
Instance.new("Animator",Humanoid).Name="Animator" Humanoid.BreakJointsOnDeath=false Humanoid.RequiresNeck=false
local Figure=und
player.Character=und
--making the joints (dont worry, i also dont know how joints work)
function waitForChild(parent, childName)
local child = parent:findFirstChild(childName)
if child then return child end
while true do
child = parent.ChildAdded:wait()
if child.Name==childName then return child end
end
end
Ghost()
function makeJoint(limbName, jointName, c0, c1)
local limb = waitForChild(Figure, limbName)
if limb==root then
else
limb:BreakJoints()
end
local joint = Instance.new"Motor6D"
joint.Name = jointName
joint.Part0 = Torso
joint.Part1 = limb
joint.C0 = c0
joint.C1 = c1
joint.MaxVelocity = 0.5
joint.archivable = true
joint.Parent = Torso
return joint
end
local Neck = makeJoint("Head","Neck", CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0), CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0))
local RightShoulder = makeJoint("Right Arm", "Right Shoulder", CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0))
local LeftShoulder = makeJoint("Left Arm", "Left Shoulder", CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0))
local RightHip = makeJoint("Right Leg", "Right Hip", CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0))
local LeftHip = makeJoint("Left Leg", "Left Hip", CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0))
-- util
function waitForChild(parent, childName)
while true do
local child = parent:findFirstChild(childName)
if child then
return child
end
parent.ChildAdded:wait()
end
end
-- declarations
--local Figure = owner.Character
--local Torso = waitForChild(Figure, "Torso")
--local Humanoid = waitForChild(Figure, "Humanoid")
--local RightShoulder = waitForChild(Torso, "Right Shoulder")
--local LeftShoulder = waitForChild(Torso, "Left Shoulder")
--local RightHip = waitForChild(Torso, "Right Hip")
--local LeftHip = waitForChild(Torso, "Left Hip")
--local Neck = waitForChild(Torso, "Neck")
-- functions
local toolAnim = "None"
local toolAnimTime = 0
-- functions
function onRunning(speed)
if speed>0 then
pose = "Running"
else
pose = "Standing"
end
end
function onDied()
pose = "Dead"
end
function onJumping(state)
pose = "Jumping"
end
function onClimbing()
pose = "Climbing"
end
function onGettingUp(state)
pose = "GettingUp"
end
function onFreeFall(state)
pose = "FreeFall"
end
function onFallingDown(state)
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function moveJump()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
-- same as jump for now
function moveFreeFall()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle = 3.14 /2
LeftShoulder.DesiredAngle = -3.14 /2
RightHip.DesiredAngle = 3.14 /2
LeftHip.DesiredAngle = -3.14 /2
end
local function getTool()
for i, v in ipairs(Figure:GetChildren()) do
if v:IsA"Tool" then
return v
end
end
return nil
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
RightShoulder.DesiredAngle = 1.57
return
end
if (toolAnim == "Slash") then
RightShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 0
return
end
if (toolAnim == "Lunge") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightHip.MaxVelocity = 0.5
LeftHip.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 1.57
LeftShoulder.DesiredAngle = 1.0
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 1.0
return
end
end
function move(time)
local amplitude
local frequency
if (pose == "Jumping") then
moveJump()
return
end
if (pose == "FreeFall") then
moveFreeFall()
return
end
if (pose == "Seated") then
moveSit()
return
end
local climbFudge = 0
if (pose == "Running") then
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
amplitude = 1
frequency = 9
elseif (pose == "Climbing") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
amplitude = 1
frequency = 9
climbFudge = 3.14
else
amplitude = 0.1
frequency = 1
end
desiredAngle = amplitude * math.sin(time*frequency)
RightShoulder.DesiredAngle = desiredAngle + climbFudge
LeftShoulder.DesiredAngle = desiredAngle - climbFudge
RightHip.DesiredAngle = -desiredAngle
LeftHip.DesiredAngle = -desiredAngle
local tool = getTool()
if tool then
animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
toolAnim = "None"
toolAnimTime = 0
end
end
-- connect events
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(onJumping)
Humanoid.Climbing:connect(onClimbing)
Humanoid.GettingUp:connect(onGettingUp)
Humanoid.FreeFalling:connect(onFreeFall)
Humanoid.FallingDown:connect(onFallingDown)
Humanoid.Seated:connect(onSeated)
-- main program
local fakeface = Instance.new('Decal',Head) fakeface.Name='face'
local runService = game:service("RunService");
while Figure.Parent~=nil do
local _, time = wait(0.1)
move(time)
end
-- main program
end
function Ghost()
local Character = player.Character
local Position = Instance.new("WedgePart").CFrame
local charname = player.Character.Name
player.Backpack:ClearAllChildren()
local head = Character:FindFirstChild('Head')
if head then
Position=head
local fa = head:FindFirstChildOfClass('Decal')
if fa then fa:Destroy()
else
local rooter= Character:FindFirstChild('HumanoidRootPart')
if rooter then
Position=rooter
end
end
end
game:GetService("RunService").Heartbeat:Connect(function()
for i,v in pairs(player.Character:GetDescendants()) do
if v:IsA("BasePart") then
Position=v.CFrame
end
end
end)
local Humanoid = Character:FindFirstChildOfClass'Humanoid'
local remote1 = Instance.new("RemoteEvent",player.Backpack) remote1.Name='grab'
local remote2 = Instance.new("RemoteEvent",player.Backpack) remote2.Name='reghost'
local remote3 = Instance.new("RemoteEvent",player.Backpack) remote3.Name='Ghost'
local attacking=false
local ghost=true
Character.Archivable=true
local p = Instance.new("Part")
localscript()
camera()
local f = Instance.new("ForceField",Character)
f.Visible=false
local ChangeIndex = function(Tab,Ind,IsPrinted)
for a,b in pairs(Ind)do
local _,c = pcall(function()
Tab[a] = b;
end);
end;
end;
local Instance2 = function(CN,P)
local a = Instance.new(CN);
ChangeIndex(a,P,1);
return a;
end;
local ochar=Character
Instance2('Folder',{Parent = ochar;});
local a = ochar:FindFirstChildOfClass('Humanoid');
a.Name = 'Ghost';
a.MaxHealth = math.huge;
a.Health = a.MaxHealth;
local b = Instance2('Folder',{Parent=workspace;});
ochar.Parent = b;
remote3.OnServerEvent:Connect(function()
dead(Position)
end)
local r6 = Character:FindFirstChild('Torso')
if r6 then
local Grabanim = Instance.new("Animation",Character) Grabanim.AnimationId='http://www.roblox.com/asset/?id=183294396'
local attackmode = Humanoid:LoadAnimation(Grabanim)
remote1.OnServerEvent:Connect(function()
if attacking==false then
attacking=true
attackmode:Play()
Humanoid.WalkSpeed=Humanoid.WalkSpeed+10
Humanoid.JumpPower=100
print('Attacking')
print('on')
else
attacking=false
attackmode:Stop()
Humanoid.WalkSpeed=Humanoid.WalkSpeed-10
Humanoid.JumpPower=50
print('Attacking')
print('off')
end
end)
r6.Touched:Connect(function(hit)
if attacking==true then
local hum = hit.Parent:FindFirstChildOfClass('Humanoid')
if hum then
local victim = hum.Parent
fakechar(victim)
ghost=false
local pla = game.Players:FindFirstChild(victim.Name)
if pla then
-- pla:LoadCharacter()
end
remote1 = Instance.new("RemoteEvent",player.Backpack) remote1.Name='grab'
remote2 = Instance.new("RemoteEvent",player.Backpack) remote2.Name='reghost'
remote3 = Instance.new("RemoteEvent",player.Backpack) remote3.Name='Ghost'
remote3.OnServerEvent:Connect(function()
dead(Position)
end)
remote2.OnServerEvent:Connect(function()
if ghost==false then
Ghost()
print('death')
else
end
end)
end
end
end)
else
local r15 = Character:FindFirstChild('UpperTorso')
if r15 then
remote1.OnServerEvent:Connect(function()
if attacking==false then
attacking=true
Humanoid.WalkSpeed=Humanoid.WalkSpeed+10
Humanoid.JumpPower=100
print('Attacking')
print('on')
else
attacking=false
Humanoid.WalkSpeed=Humanoid.WalkSpeed-10
Humanoid.JumpPower=50
print('Attacking')
print('off')
end
end)
r15.Touched:Connect(function(hit)
if attacking==true then
local hum = hit.Parent:FindFirstChildOfClass('Humanoid')
if hum then
local victim = hum.Parent
fakechar(victim)
ghost=false
local pla = game.Players:FindFirstChild(victim.Name)
if pla then
-- pla:LoadCharacter()
end
remote1 = Instance.new("RemoteEvent",player.Backpack) remote1.Name='grab'
remote2 = Instance.new("RemoteEvent",player.Backpack) remote2.Name='reghost'
remote3 = Instance.new("RemoteEvent",player.Backpack) remote3.Name='Ghost'
remote3.OnServerEvent:Connect(function()
dead(Position)
end)
remote2.OnServerEvent:Connect(function()
if ghost==false then
Ghost()
print('death')
else
end
end)
end
end
end)
for i,v in pairs(Character:GetDescendants()) do
if v:IsA("BasePart") then
v.CanCollide=false
end
end
end
end
wait()
for i,v in pairs(Character:GetDescendants()) do
if v:IsA("BasePart") then
v.Color=Color3.new()
if v.Name=='HumanoidRootPart' then
v.Transparency=1
else
v.Transparency=.8
if v.Name=='Head' then
v.Transparency=.9
end
end
end
end
end
dead(player.Character.HumanoidRootPart.CFrame)