Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- rcf = owner.Character.HumanoidRootPart.CFrame
- owner:LoadCharacter()
- owner.Character.Humanoid.Animator:Destroy()
- owner.Character.Torso.CFrame = rcf
- char = owner.Character
- if char:FindFirstChild("Head") then
- if char.Head:FindFirstChild("face") ~= nil then
- face = char.Head:FindFirstChild("face")
- face.Texture = "rbxassetid://3248568733"
- face.Parent.Mesh.MeshType = "FileMesh"
- face.Parent.Mesh.MeshId = "rbxassetid://1068249467"
- end
- for i,v in pairs(char:GetChildren()) do
- if v.ClassName == "Shirt" or v.ClassName == "Pants" or v.ClassName == "Accessory" or v.ClassName == "CharacterMesh" or v.ClassName == "ShirtGraphic" then
- v:Remove()
- end
- if v.ClassName == "BodyColors" then
- v.HeadColor = BrickColor.new("Bright yellow")
- v.LeftArmColor = BrickColor.new("Bright yellow")
- v.LeftLegColor = BrickColor.new("Br. yellowish green")
- v.RightArmColor = BrickColor.new("Bright yellow")
- v.RightLegColor = BrickColor.new("Br. yellowish green")
- v.TorsoColor = BrickColor.Random()
- local Shirt = Instance.new("Shirt",face.Parent.Parent)
- Shirt.ShirtTemplate = "rbxassetid://1110695025"
- local Pants = Instance.new("Pants",face.Parent.Parent)
- Pants.PantsTemplate = "rbxassetid://1110798365"
- local TShirt = Instance.new("ShirtGraphic",face.Parent.Parent)
- TShirt.Graphic = "rbxassetid://2650823790"
- local TorsMesh = Instance.new("CharacterMesh", face.Parent.Parent)
- TorsMesh.BodyPart = "Torso"
- TorsMesh.MeshId = 1112228624
- local RAMesh = Instance.new("CharacterMesh", face.Parent.Parent)
- RAMesh.BodyPart = "RightArm"
- RAMesh.MeshId = 1112244824
- local LAMesh = Instance.new("CharacterMesh", face.Parent.Parent)
- LAMesh.BodyPart = "LeftArm"
- LAMesh.MeshId = 1112256772
- local RLMesh = Instance.new("CharacterMesh", face.Parent.Parent)
- RLMesh.BodyPart = "RightLeg"
- RLMesh.MeshId = 1112267576
- local LLMesh = Instance.new("CharacterMesh", face.Parent.Parent)
- LLMesh.BodyPart = "LeftLeg"
- LLMesh.MeshId = 1112275294
- end
- if v.ClassName == "Part" then
- if v.Name == "Head" or v.Name == "FalseHead" then
- v.BrickColor = BrickColor.new("Bright yellow")
- else
- v.BrickColor = BrickColor.new("Bright yellow")
- end
- end
- end
- end
- local Figure = owner.Character
- local Torso = waitForChild(Figure, "Torso")
- 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")
- local Humanoid = waitForChild(Figure, "Humanoid")
- for _,v in pairs (Figure:children()) do
- if v:IsA("Part") then v.CanCollide = true end
- end
- --[[
- Figure.HumanoidRootPart.Running.SoundId = "rbxassetid://174960816"
- Figure.HumanoidRootPart.Running.Volume = 10
- Figure.HumanoidRootPart.Running.PlaybackSpeed = 1
- Figure.HumanoidRootPart.Climbing.SoundId = "rbxassetid://174960816"
- Figure.HumanoidRootPart.Climbing.Volume = 10
- Figure.HumanoidRootPart.Climbing.PlaybackSpeed = 1
- Figure.HumanoidRootPart.Jumping.SoundId = "rbxassetid://400942696"
- Figure.Head.Jumping.Volume = 10
- ]]--
- function onRunning(speed)
- if speed>0 then
- pose = "Running"
- else
- pose = "Standing"
- end
- end
- function onDied()
- pose = "Dead"
- Humanoid.AutoRotate = true
- end
- function onJumping()
- pose = "Jumping"
- Humanoid.AutoRotate = false
- end
- function onClimbing()
- pose = "Climbing"
- end
- function onGettingUp()
- pose = "GettingUp"
- Humanoid.AutoRotate = true
- end
- function onFreeFall()
- pose = "FreeFall"
- Humanoid.AutoRotate = false
- end
- function onFallingDown()
- pose = "FallingDown"
- Humanoid.AutoRotate = true
- end
- function onSeated()
- pose = "Seated"
- Humanoid.AutoRotate = true
- end
- function onPlatformStanding()
- pose = "PlatformStanding"
- Humanoid.AutoRotate = true
- 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
- Humanoid.AutoRotate = false
- 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
- Humanoid.AutoRotate = false
- end
- function moveSit()
- RightShoulder.MaxVelocity = 0.1
- LeftShoulder.MaxVelocity = 0.1
- RightShoulder.DesiredAngle = 3.14/2
- LeftShoulder.DesiredAngle = -3.14/2
- RightHip.DesiredAngle = 3.14/2
- LeftHip.DesiredAngle = -3.14/2
- Humanoid.AutoRotate = true
- end
- function getTool()
- for _, kid in ipairs(Figure:GetChildren()) do
- if kid.className == "Tool" then return kid 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
- toolAnim = ""
- 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 = 0
- RightHip.DesiredAngle = 1.57
- LeftHip.DesiredAngle = 1.0
- return
- end
- end
- function move(time)
- local amplitude
- local frequency
- local toolAnimTime
- 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.1
- LeftShoulder.MaxVelocity = 0.1
- amplitude = 0.85
- frequency = 9
- Humanoid.AutoRotate = true
- elseif (pose == "Climbing") then
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- amplitude = 0.85
- frequency = 9
- climbFudge = 3.14
- Humanoid.AutoRotate = true
- else
- amplitude = 0.1
- frequency = 1
- Humanoid.AutoRotate = true
- 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)
- Humanoid.PlatformStanding:connect(onPlatformStanding)
- -- main program
- local runService = game:service("RunService");
- plr = owner
- char = plr.Character
- clerp = function(toclerp, cf, number)
- local joint = toclerp
- joint.C0 = joint.C0:Lerp(cf, number)
- end
- clerp2 = function(toclerp, cf)
- local joint = toclerp
- joint.C0 = cf
- end
- clerp3 = function(toclerp, cf, number)
- local joint = toclerp
- joint.C1 = joint.C1:Lerp(cf, number)
- end
- Swait,swait = function(number)
- if number == 0 or number == nil then
- game:GetService("RunService").Heartbeat:Wait()
- else
- for i = 1,number do
- game:GetService("RunService").Heartbeat:Wait()
- end
- end
- end
- ezweld = function(p, a, b, cf)
- local weld = Instance.new("Weld",p)
- weld.Part0 = a
- weld.Part1 = b
- weld.C0 = cf
- return weld
- end
- NewSound = function(p, id, pit, vol, loop)
- local Sound = Instance.new("Sound",p)
- Sound.Pitch = pit
- Sound.Volume = vol
- Sound.SoundId = "rbxassetid://" ..id
- Sound.Looped = loop
- Sound:Play()
- return Sound
- end
- local jomp = NewSound(Torso, 400942696, 1, 10, false)
- local wolk = NewSound(Torso, 174960816, 1, 10, true)
- Humanoid:GetPropertyChangedSignal("Jump"):Connect(function()
- if Humanoid.Jump == true and jomp.Playing == false then
- jomp:Play()
- wolk:Stop()
- end
- end)
- Humanoid.Running:connect(function(speed)
- if speed > 0 then
- wolk.Playing = true
- else
- wolk:Stop()
- end
- end)
- function fake(part)
- local fake = Instance.new("Part", part.Parent)
- fake.Size = part.Size
- fake.Color = part.Color
- fake.Anchored = part.Anchored
- fake.CFrame = part.CFrame
- fake.CanCollide = true
- fake.Transparency = 1
- fake.Locked = true
- --fake.LeftSurface = part.LeftSurface
- --fake.RightSurface = part.RightSurface
- --fake.TopSurface = part.TopSurface
- --fake.BottomSurface = part.BottomSurface
- --fake.FrontSurface = part.FrontSurface
- --fake.BackSurface = part.BackSurface
- for i,v in pairs (part:children()) do
- if v:IsA("SpecialMesh") or v:IsA("Decal") then
- v:Clone().Parent = fake
- end
- end
- local weld = ezweld(part.Parent, fake, part, CFrame.new())
- return fake
- end
- for i,v in pairs (char:GetDescendants()) do
- if v:IsA("Part") or v:IsA("MeshPart") then
- fake(v)
- end
- end
- NLS([[
- plr = owner
- char = plr.Character
- hum = char.Humanoid
- mouse = plr:GetMouse()
- local mudel = Instance.new("Model", char)
- mudel.Name = "AHHAHDADAHDHASDGADH"
- local neon = Instance.new("Part", workspace)
- neon.Shape = "Cylinder"
- neon.Material = "Neon"
- neon.Transparency = 0
- neon.CastShadow = true
- neon.Color = Color3.new(0, 0.75, 0)
- neon.CFrame = neon.CFrame*CFrame.Angles(0, 0, math.rad(90))
- neon.Size = Vector3.new(0.25, 3, 3)
- neon.Position = mouse.Hit.p
- mouse.Icon = "http://www.roblox.com/asset/?id=172802980"
- mouse.Button1Down:connect(function()
- if mudel.Parent == char then
- hum:MoveTo(mouse.Hit.p)
- local c = neon:Clone()
- c.Parent = mudel
- local ack = neon.Touched:connect(function(hit)
- if hit.Parent == char then
- Debris:AddItem(c, 0.01)
- end
- end)
- end
- end)
- game:service("RunService").RenderStepped:connect(function()
- neon.Position = mouse.Hit.p
- neon.Anchored = true
- neon.CanCollide = true
- neon.Parent = mudel
- for i,v in pairs (char:children()) do
- if v:IsA("Tool") then
- mudel.Parent = nil
- else
- mudel.Parent = char
- end
- end
- end)
- ]], Figure)
- while game:service("RunService").Heartbeat:Wait() do
- local _, time = wait()
- move(time)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement