Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Model0 = Instance.new("Model")
- Part1 = Instance.new("Part")
- Motor6D2 = Instance.new("Motor6D")
- Part3 = Instance.new("Part")
- BodyForce4 = Instance.new("BodyForce")
- Motor6D5 = Instance.new("Motor6D")
- Motor6D6 = Instance.new("Motor6D")
- Motor6D7 = Instance.new("Motor6D")
- Motor6D8 = Instance.new("Motor6D")
- Motor6D9 = Instance.new("Motor6D")
- Part10 = Instance.new("Part")
- Part11 = Instance.new("Part")
- Part12 = Instance.new("Part")
- Part13 = Instance.new("Part")
- Part14 = Instance.new("Part")
- SpecialMesh15 = Instance.new("SpecialMesh")
- Humanoid16 = Instance.new("Humanoid")
- Script17 = Instance.new("Script")
- StringValue18 = Instance.new("StringValue")
- Animation19 = Instance.new("Animation")
- StringValue20 = Instance.new("StringValue")
- Animation21 = Instance.new("Animation")
- StringValue22 = Instance.new("StringValue")
- Animation23 = Instance.new("Animation")
- NumberValue24 = Instance.new("NumberValue")
- Animation25 = Instance.new("Animation")
- NumberValue26 = Instance.new("NumberValue")
- StringValue27 = Instance.new("StringValue")
- Animation28 = Instance.new("Animation")
- StringValue29 = Instance.new("StringValue")
- Animation30 = Instance.new("Animation")
- StringValue31 = Instance.new("StringValue")
- Animation32 = Instance.new("Animation")
- StringValue33 = Instance.new("StringValue")
- Animation34 = Instance.new("Animation")
- BodyColors35 = Instance.new("BodyColors")
- Script36 = Instance.new("Script")
- Shirt37 = Instance.new("Shirt")
- Pants38 = Instance.new("Pants")
- Model0.Name = "Clone"
- Model0.Parent = mas
- Part1.Name = "HumanoidRootPart"
- Part1.Parent = Model0
- Part1.CFrame = CFrame.new(-29.7313805, 2.99998093, -59.1259232, 4.49369422e-21, 7.01608598e-23, -1, -8.6405519e-23, 0.999991894, 7.01614782e-23, 1, 8.64048753e-23, 4.49369422e-21)
- Part1.Orientation = Vector3.new(0, -90, 0)
- Part1.Position = Vector3.new(-29.7313805, 2.99998093, -59.1259232)
- Part1.Rotation = Vector3.new(0, -90, 0)
- Part1.Color = Color3.new(0.152941, 0.27451, 0.176471)
- Part1.Transparency = 1
- Part1.Size = Vector3.new(2, 2, 1)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.BrickColor = BrickColor.new("Earth green")
- Part1.Material = Enum.Material.SmoothPlastic
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("Earth green")
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.formFactor = Enum.FormFactor.Symmetric
- Motor6D2.Name = "Root Hip"
- Motor6D2.Parent = Part1
- Motor6D2.MaxVelocity = 0.10000000149012
- Motor6D2.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D2.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D2.Part0 = Part1
- Motor6D2.Part1 = Part3
- Motor6D2.part1 = Part3
- Part3.Name = "Torso"
- Part3.Parent = Model0
- Part3.CFrame = CFrame.new(-29.7313805, 2.99998093, -59.1259232, 4.49369422e-21, 7.01608598e-23, -1, -8.6405519e-23, 0.999991894, 7.01614782e-23, 1, 8.64048753e-23, 4.49369422e-21)
- Part3.Orientation = Vector3.new(0, -90, 0)
- Part3.Position = Vector3.new(-29.7313805, 2.99998093, -59.1259232)
- Part3.Rotation = Vector3.new(0, -90, 0)
- Part3.Color = Color3.new(0.105882, 0.164706, 0.207843)
- Part3.Size = Vector3.new(2, 2, 1)
- Part3.BottomSurface = Enum.SurfaceType.Smooth
- Part3.BrickColor = BrickColor.new("Black")
- Part3.Material = Enum.Material.SmoothPlastic
- Part3.TopSurface = Enum.SurfaceType.Smooth
- Part3.brickColor = BrickColor.new("Black")
- Part3.FormFactor = Enum.FormFactor.Symmetric
- Part3.formFactor = Enum.FormFactor.Symmetric
- BodyForce4.Name = "RepulsionForce"
- BodyForce4.Parent = Part3
- BodyForce4.Force = Vector3.new(0, 0, 0)
- BodyForce4.force = Vector3.new(0, 0, 0)
- Motor6D5.Name = "Right Shoulder"
- Motor6D5.Parent = Part3
- Motor6D5.MaxVelocity = 0.10000000149012
- Motor6D5.C0 = CFrame.new(1, 0.5, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- Motor6D5.C1 = CFrame.new(-0.5, 0.5, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- Motor6D5.Part0 = Part3
- Motor6D5.Part1 = Part13
- Motor6D5.part1 = Part13
- Motor6D6.Name = "Left Shoulder"
- Motor6D6.Parent = Part3
- Motor6D6.MaxVelocity = 0.10000000149012
- Motor6D6.C0 = CFrame.new(-1, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
- Motor6D6.C1 = CFrame.new(0.5, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
- Motor6D6.Part0 = Part3
- Motor6D6.Part1 = Part12
- Motor6D6.part1 = Part12
- Motor6D7.Name = "Right Hip"
- Motor6D7.Parent = Part3
- Motor6D7.MaxVelocity = 0.10000000149012
- Motor6D7.C0 = CFrame.new(1, -1, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- Motor6D7.C1 = CFrame.new(0.5, 1, 0, -4.37113883e-08, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883e-08)
- Motor6D7.Part0 = Part3
- Motor6D7.Part1 = Part11
- Motor6D7.part1 = Part11
- Motor6D8.Name = "Left Hip"
- Motor6D8.Parent = Part3
- Motor6D8.MaxVelocity = 0.10000000149012
- Motor6D8.C0 = CFrame.new(-1, -1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
- Motor6D8.C1 = CFrame.new(-0.5, 1, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
- Motor6D8.Part0 = Part3
- Motor6D8.Part1 = Part10
- Motor6D8.part1 = Part10
- Motor6D9.Name = "Neck"
- Motor6D9.Parent = Part3
- Motor6D9.MaxVelocity = 0.10000000149012
- Motor6D9.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D9.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D9.Part0 = Part3
- Motor6D9.Part1 = Part14
- Motor6D9.part1 = Part14
- Part10.Name = "Left Leg"
- Part10.Parent = Model0
- Part10.CFrame = CFrame.new(-29.7313805, 0.999997258, -59.6259232, 4.49369422e-21, 7.01608535e-23, -1, -8.6405519e-23, 0.999991775, 7.01614782e-23, 1, 8.64048626e-23, 4.49369422e-21)
- Part10.Orientation = Vector3.new(0, -90, 0)
- Part10.Position = Vector3.new(-29.7313805, 0.999997258, -59.6259232)
- Part10.Rotation = Vector3.new(0, -90, 0)
- Part10.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part10.Size = Vector3.new(1, 2, 1)
- Part10.BottomSurface = Enum.SurfaceType.Smooth
- Part10.BrickColor = BrickColor.new("Grime")
- Part10.CanCollide = false
- Part10.Material = Enum.Material.SmoothPlastic
- Part10.TopSurface = Enum.SurfaceType.Smooth
- Part10.brickColor = BrickColor.new("Grime")
- Part10.FormFactor = Enum.FormFactor.Symmetric
- Part10.formFactor = Enum.FormFactor.Symmetric
- Part11.Name = "Right Leg"
- Part11.Parent = Model0
- Part11.CFrame = CFrame.new(-29.7313805, 0.999997258, -58.6259232, 4.49369422e-21, 7.01608535e-23, -1, -8.6405519e-23, 0.999991775, 7.01614782e-23, 1, 8.64048626e-23, 4.49369422e-21)
- Part11.Orientation = Vector3.new(0, -90, 0)
- Part11.Position = Vector3.new(-29.7313805, 0.999997258, -58.6259232)
- Part11.Rotation = Vector3.new(0, -90, 0)
- Part11.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part11.Size = Vector3.new(1, 2, 1)
- Part11.BottomSurface = Enum.SurfaceType.Smooth
- Part11.BrickColor = BrickColor.new("Grime")
- Part11.CanCollide = false
- Part11.Material = Enum.Material.SmoothPlastic
- Part11.TopSurface = Enum.SurfaceType.Smooth
- Part11.brickColor = BrickColor.new("Grime")
- Part11.FormFactor = Enum.FormFactor.Symmetric
- Part11.formFactor = Enum.FormFactor.Symmetric
- Part12.Name = "Left Arm"
- Part12.Parent = Model0
- Part12.CFrame = CFrame.new(-29.7313805, 2.99998093, -60.6259232, 4.49369422e-21, 7.01608535e-23, -1, -8.6405519e-23, 0.999991775, 7.01614782e-23, 1, 8.64048626e-23, 4.49369422e-21)
- Part12.Orientation = Vector3.new(0, -90, 0)
- Part12.Position = Vector3.new(-29.7313805, 2.99998093, -60.6259232)
- Part12.Rotation = Vector3.new(0, -90, 0)
- Part12.Color = Color3.new(1, 0.8, 0.6)
- Part12.Size = Vector3.new(1, 2, 1)
- Part12.BottomSurface = Enum.SurfaceType.Smooth
- Part12.BrickColor = BrickColor.new("Pastel brown")
- Part12.CanCollide = false
- Part12.Material = Enum.Material.SmoothPlastic
- Part12.TopSurface = Enum.SurfaceType.Smooth
- Part12.brickColor = BrickColor.new("Pastel brown")
- Part12.FormFactor = Enum.FormFactor.Symmetric
- Part12.formFactor = Enum.FormFactor.Symmetric
- Part13.Name = "Right Arm"
- Part13.Parent = Model0
- Part13.CFrame = CFrame.new(-29.7313805, 2.99998093, -57.6259232, 4.49369422e-21, 7.01608535e-23, -1, -8.6405519e-23, 0.999991775, 7.01614782e-23, 1, 8.64048626e-23, 4.49369422e-21)
- Part13.Orientation = Vector3.new(0, -90, 0)
- Part13.Position = Vector3.new(-29.7313805, 2.99998093, -57.6259232)
- Part13.Rotation = Vector3.new(0, -90, 0)
- Part13.Color = Color3.new(1, 0.8, 0.6)
- Part13.Size = Vector3.new(1, 2, 1)
- Part13.BottomSurface = Enum.SurfaceType.Smooth
- Part13.BrickColor = BrickColor.new("Pastel brown")
- Part13.CanCollide = false
- Part13.Material = Enum.Material.SmoothPlastic
- Part13.TopSurface = Enum.SurfaceType.Smooth
- Part13.brickColor = BrickColor.new("Pastel brown")
- Part13.FormFactor = Enum.FormFactor.Symmetric
- Part13.formFactor = Enum.FormFactor.Symmetric
- Part14.Name = "Head"
- Part14.Parent = Model0
- Part14.CFrame = CFrame.new(-29.7313805, 4.49996853, -59.1259232, 4.49369422e-21, 7.01608598e-23, -1, -8.6405519e-23, 0.999991894, 7.01614782e-23, 1, 8.64048753e-23, 4.49369422e-21)
- Part14.Orientation = Vector3.new(0, -90, 0)
- Part14.Position = Vector3.new(-29.7313805, 4.49996853, -59.1259232)
- Part14.Rotation = Vector3.new(0, -90, 0)
- Part14.Color = Color3.new(1, 0.8, 0.6)
- Part14.Size = Vector3.new(2, 1, 1)
- Part14.BottomSurface = Enum.SurfaceType.Smooth
- Part14.BrickColor = BrickColor.new("Pastel brown")
- Part14.Material = Enum.Material.SmoothPlastic
- Part14.TopSurface = Enum.SurfaceType.Smooth
- Part14.brickColor = BrickColor.new("Pastel brown")
- Part14.FormFactor = Enum.FormFactor.Symmetric
- Part14.formFactor = Enum.FormFactor.Symmetric
- SpecialMesh15.Parent = Part14
- SpecialMesh15.Scale = Vector3.new(1.25, 1.25, 1.25)
- Humanoid16.Parent = Model0
- Humanoid16.Health = 500
- Humanoid16.LeftLeg = Part10
- Humanoid16.MaxHealth = 500
- Humanoid16.RightLeg = Part11
- Humanoid16.Torso = Part1
- Humanoid16.WalkSpeed = 20
- Humanoid16.maxHealth = 500
- Script17.Name = "Animate"
- Script17.Parent = Model0
- table.insert(cors,sandbox(Script17,function()
- 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
- local Figure = script.Parent
- 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")
- local pose = "Standing"
- local currentAnim = ""
- local currentAnimTrack = nil
- local currentAnimKeyframeHandler = nil
- local currentAnimSpeed = 1.0
- local animTable = {}
- local animNames = {
- idle = {
- { id = "http://www.roblox.com/asset/?id=125750544", weight = 9 },
- { id = "http://www.roblox.com/asset/?id=125750618", weight = 1 }
- },
- walk = {
- { id = "http://www.roblox.com/asset/?id=125749145", weight = 10 }
- },
- run = {
- { id = "run.xml", weight = 10 }
- },
- jump = {
- { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
- },
- fall = {
- { id = "http://www.roblox.com/asset/?id=125750759", weight = 10 }
- },
- climb = {
- { id = "http://www.roblox.com/asset/?id=125750800", weight = 10 }
- },
- toolnone = {
- { id = "http://www.roblox.com/asset/?id=125750867", weight = 10 }
- },
- toolslash = {
- { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
- -- { id = "slash.xml", weight = 10 }
- },
- toollunge = {
- { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
- },
- wave = {
- { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
- },
- point = {
- { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
- },
- dance = {
- { id = "http://www.roblox.com/asset/?id=130018893", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=132546839", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=132546884", weight = 10 }
- },
- dance2 = {
- { id = "http://www.roblox.com/asset/?id=160934142", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=160934298", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=160934376", weight = 10 }
- },
- dance3 = {
- { id = "http://www.roblox.com/asset/?id=160934458", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=160934530", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=160934593", weight = 10 }
- },
- laugh = {
- { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
- },
- cheer = {
- { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
- },
- }
- -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
- local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
- math.randomseed(tick())
- function configureAnimationSet(name, fileList)
- if (animTable[name] ~= nil) then
- for _, connection in pairs(animTable[name].connections) do
- connection:disconnect()
- end
- end
- animTable[name] = {}
- animTable[name].count = 0
- animTable[name].totalWeight = 0
- animTable[name].connections = {}
- -- check for config values
- local config = script:FindFirstChild(name)
- if (config ~= nil) then
- -- print("Loading anims " .. name)
- table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
- table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
- local idx = 1
- for _, childPart in pairs(config:GetChildren()) do
- if (childPart:IsA("Animation")) then
- table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
- animTable[name][idx] = {}
- animTable[name][idx].anim = childPart
- local weightObject = childPart:FindFirstChild("Weight")
- if (weightObject == nil) then
- animTable[name][idx].weight = 1
- else
- animTable[name][idx].weight = weightObject.Value
- end
- animTable[name].count = animTable[name].count + 1
- animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
- -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
- idx = idx + 1
- end
- end
- end
- -- fallback to defaults
- if (animTable[name].count <= 0) then
- for idx, anim in pairs(fileList) do
- animTable[name][idx] = {}
- animTable[name][idx].anim = Instance.new("Animation")
- animTable[name][idx].anim.Name = name
- animTable[name][idx].anim.AnimationId = anim.id
- animTable[name][idx].weight = anim.weight
- animTable[name].count = animTable[name].count + 1
- animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
- -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
- end
- end
- end
- -- Setup animation objects
- function scriptChildModified(child)
- local fileList = animNames[child.Name]
- if (fileList ~= nil) then
- configureAnimationSet(child.Name, fileList)
- end
- end
- script.ChildAdded:connect(scriptChildModified)
- script.ChildRemoved:connect(scriptChildModified)
- for name, fileList in pairs(animNames) do
- configureAnimationSet(name, fileList)
- end
- -- ANIMATION
- -- declarations
- local toolAnim = "None"
- local toolAnimTime = 0
- local jumpAnimTime = 0
- local jumpAnimDuration = 0.3
- local toolTransitionTime = 0.1
- local fallTransitionTime = 0.3
- local jumpMaxLimbVelocity = 0.75
- -- functions
- function stopAllAnimations()
- local oldAnim = currentAnim
- -- return to idle if finishing an emote
- if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
- oldAnim = "idle"
- end
- currentAnim = ""
- if (currentAnimKeyframeHandler ~= nil) then
- currentAnimKeyframeHandler:disconnect()
- end
- if (currentAnimTrack ~= nil) then
- currentAnimTrack:Stop()
- currentAnimTrack:Destroy()
- currentAnimTrack = nil
- end
- return oldAnim
- end
- function setAnimationSpeed(speed)
- if speed ~= currentAnimSpeed then
- currentAnimSpeed = speed
- currentAnimTrack:AdjustSpeed(currentAnimSpeed)
- end
- end
- function keyFrameReachedFunc(frameName)
- if (frameName == "End") then
- -- print("Keyframe : ".. frameName)
- local repeatAnim = stopAllAnimations()
- local animSpeed = currentAnimSpeed
- playAnimation(repeatAnim, 0.0, Humanoid)
- setAnimationSpeed(animSpeed)
- end
- end
- -- Preload animations
- function playAnimation(animName, transitionTime, humanoid)
- local idleFromEmote = (animName == "idle" and emoteNames[currentAnim] ~= nil)
- if (animName ~= currentAnim and not idleFromEmote) then
- if (currentAnimTrack ~= nil) then
- currentAnimTrack:Stop(transitionTime)
- currentAnimTrack:Destroy()
- end
- currentAnimSpeed = 1.0
- local roll = math.random(1, animTable[animName].totalWeight)
- local origRoll = roll
- local idx = 1
- while (roll > animTable[animName][idx].weight) do
- roll = roll - animTable[animName][idx].weight
- idx = idx + 1
- end
- -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
- local anim = animTable[animName][idx].anim
- -- load it to the humanoid; get AnimationTrack
- currentAnimTrack = humanoid:LoadAnimation(anim)
- -- play the animation
- currentAnimTrack:Play(transitionTime)
- currentAnim = animName
- -- set up keyframe name triggers
- if (currentAnimKeyframeHandler ~= nil) then
- currentAnimKeyframeHandler:disconnect()
- end
- currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
- end
- end
- -------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------
- local toolAnimName = ""
- local toolAnimTrack = nil
- local currentToolAnimKeyframeHandler = nil
- function toolKeyFrameReachedFunc(frameName)
- if (frameName == "End") then
- -- print("Keyframe : ".. frameName)
- local repeatAnim = stopToolAnimations()
- playToolAnimation(repeatAnim, 0.0, Humanoid)
- end
- end
- function playToolAnimation(animName, transitionTime, humanoid)
- if (animName ~= toolAnimName) then
- if (toolAnimTrack ~= nil) then
- toolAnimTrack:Stop()
- toolAnimTrack:Destroy()
- transitionTime = 0
- end
- local roll = math.random(1, animTable[animName].totalWeight)
- local origRoll = roll
- local idx = 1
- while (roll > animTable[animName][idx].weight) do
- roll = roll - animTable[animName][idx].weight
- idx = idx + 1
- end
- -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
- local anim = animTable[animName][idx].anim
- -- load it to the humanoid; get AnimationTrack
- toolAnimTrack = humanoid:LoadAnimation(anim)
- -- play the animation
- toolAnimTrack:Play(transitionTime)
- toolAnimName = animName
- currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
- end
- end
- function stopToolAnimations()
- local oldAnim = toolAnimName
- if (currentToolAnimKeyframeHandler ~= nil) then
- currentToolAnimKeyframeHandler:disconnect()
- end
- toolAnimName = ""
- if (toolAnimTrack ~= nil) then
- toolAnimTrack:Stop()
- toolAnimTrack:Destroy()
- toolAnimTrack = nil
- end
- return oldAnim
- end
- -------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------
- function onRunning(speed)
- if speed>0.01 then
- playAnimation("walk", 0.1, Humanoid)
- pose = "Running"
- else
- playAnimation("idle", 0.1, Humanoid)
- pose = "Standing"
- end
- end
- function onDied()
- pose = "Dead"
- end
- function onJumping()
- playAnimation("jump", 0.1, Humanoid)
- jumpAnimTime = jumpAnimDuration
- pose = "Jumping"
- end
- function onClimbing(speed)
- playAnimation("climb", 0.1, Humanoid)
- setAnimationSpeed(speed / 12.0)
- pose = "Climbing"
- end
- function onGettingUp()
- pose = "GettingUp"
- end
- function onFreeFall()
- if (jumpAnimTime <= 0) then
- playAnimation("fall", fallTransitionTime, Humanoid)
- end
- pose = "FreeFall"
- end
- function onFallingDown()
- pose = "FallingDown"
- end
- function onSeated()
- pose = "Seated"
- end
- function onPlatformStanding()
- pose = "PlatformStanding"
- end
- function onSwimming(speed)
- if speed>0 then
- pose = "Running"
- else
- pose = "Standing"
- end
- 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
- function animateTool()
- if (toolAnim == "None") then
- playToolAnimation("toolnone", toolTransitionTime, Humanoid)
- return
- end
- if (toolAnim == "Slash") then
- playToolAnimation("toolslash", 0, Humanoid)
- return
- end
- if (toolAnim == "Lunge") then
- playToolAnimation("toollunge", 0, Humanoid)
- return
- end
- end
- function moveSit()
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- RightShoulder:SetDesiredAngle(3.14 /2)
- LeftShoulder:SetDesiredAngle(-3.14 /2)
- RightHip:SetDesiredAngle(3.14 /2)
- LeftHip:SetDesiredAngle(-3.14 /2)
- end
- local lastTick = 0
- function move(time)
- local amplitude = 1
- local frequency = 1
- local deltaTime = time - lastTick
- lastTick = time
- local climbFudge = 0
- local setAngles = false
- if (jumpAnimTime > 0) then
- jumpAnimTime = jumpAnimTime - deltaTime
- end
- if (pose == "FreeFall" and jumpAnimTime <= 0) then
- playAnimation("fall", fallTransitionTime, Humanoid)
- elseif (pose == "Seated") then
- stopAllAnimations()
- moveSit()
- return
- elseif (pose == "Running") then
- playAnimation("walk", 0.1, Humanoid)
- elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
- -- print("Wha " .. pose)
- amplitude = 0.1
- frequency = 1
- setAngles = true
- end
- if (setAngles) then
- desiredAngle = amplitude * math.sin(time * frequency)
- RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
- LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
- RightHip:SetDesiredAngle(-desiredAngle)
- LeftHip:SetDesiredAngle(-desiredAngle)
- end
- -- Tool Animation handling
- 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
- stopToolAnimations()
- 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)
- Humanoid.Swimming:connect(onSwimming)
- -- main program
- local runService = game:service("RunService");
- -- initialize to idle
- playAnimation("idle", 0.1, Humanoid)
- pose = "Standing"
- while Figure.Parent~=nil do
- local _, time = wait(0.1)
- move(time)
- end
- end))
- StringValue18.Name = "climb"
- StringValue18.Parent = Script17
- Animation19.Name = "ClimbAnim"
- Animation19.Parent = StringValue18
- Animation19.AnimationId = "http://www.roblox.com/asset/?id=125750800"
- StringValue20.Name = "fall"
- StringValue20.Parent = Script17
- Animation21.Name = "FallAnim"
- Animation21.Parent = StringValue20
- Animation21.AnimationId = "rbxassetid://399379775"
- StringValue22.Name = "idle"
- StringValue22.Parent = Script17
- Animation23.Name = "Animation1"
- Animation23.Parent = StringValue22
- Animation23.AnimationId = "rbxassetid://396524805"
- NumberValue24.Name = "Weight"
- NumberValue24.Parent = Animation23
- NumberValue24.Value = 9
- Animation25.Name = "Animation2"
- Animation25.Parent = StringValue22
- Animation25.AnimationId = "rbxassetid://396524805"
- NumberValue26.Name = "Weight"
- NumberValue26.Parent = Animation25
- NumberValue26.Value = 1
- StringValue27.Name = "jump"
- StringValue27.Parent = Script17
- Animation28.Name = "JumpAnim"
- Animation28.Parent = StringValue27
- Animation28.AnimationId = "rbxassetid://399378534"
- StringValue29.Name = "run"
- StringValue29.Parent = Script17
- Animation30.Name = "RunAnim"
- Animation30.Parent = StringValue29
- Animation30.AnimationId = "rbxassetid://399377124"
- StringValue31.Name = "toolnone"
- StringValue31.Parent = Script17
- Animation32.Name = "ToolNoneAnim"
- Animation32.Parent = StringValue31
- Animation32.AnimationId = "http://www.roblox.com/asset/?id=125750867"
- StringValue33.Name = "walk"
- StringValue33.Parent = Script17
- Animation34.Name = "WalkAnim"
- Animation34.Parent = StringValue33
- Animation34.AnimationId = "rbxassetid://399377124"
- BodyColors35.Parent = nil
- BodyColors35.HeadColor = BrickColor.new("Medium stone grey")
- BodyColors35.HeadColor3 = Color3.new(0.639216, 0.635294, 0.647059)
- BodyColors35.LeftArmColor = BrickColor.new("Medium stone grey")
- BodyColors35.LeftArmColor3 = Color3.new(0.639216, 0.635294, 0.647059)
- BodyColors35.LeftLegColor = BrickColor.new("Medium stone grey")
- BodyColors35.LeftLegColor3 = Color3.new(0.639216, 0.635294, 0.647059)
- BodyColors35.RightArmColor = BrickColor.new("Medium stone grey")
- BodyColors35.RightArmColor3 = Color3.new(0.639216, 0.635294, 0.647059)
- BodyColors35.RightLegColor = BrickColor.new("Medium stone grey")
- BodyColors35.RightLegColor3 = Color3.new(0.639216, 0.635294, 0.647059)
- BodyColors35.TorsoColor = BrickColor.new("Medium stone grey")
- BodyColors35.TorsoColor3 = Color3.new(0.639216, 0.635294, 0.647059)
- Script36.Name = "Respawn"
- Script36.Parent = Model0
- table.insert(cors,sandbox(Script36,function()
- name="Humanoid"
- robo=script.Parent:clone()
- while true do
- wait(5)
- if script.Parent.Humanoid.Health<1 then
- robot=robo:clone()
- robot.Parent=script.Parent.Parent
- robot:makeJoints()
- script.Parent:remove()
- end
- end
- end))
- Shirt37.Name = "Shirt"
- Shirt37.Parent = Model0
- Pants38.Name = "Pants"
- Pants38.Parent = Model0
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = script
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
- Model0.Torso.CFrame = owner.Character.Torso.CFrame
- while true do
- wait()
- Humanoid16.WalkToPoint = owner.Character.Torso.Position
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement