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")
- SpecialMesh2 = Instance.new("SpecialMesh")
- Sound3 = Instance.new("Sound")
- Sound4 = Instance.new("Sound")
- Decal5 = Instance.new("Decal")
- Weld6 = Instance.new("Weld")
- Weld7 = Instance.new("Weld")
- Part8 = Instance.new("Part")
- Motor6D9 = Instance.new("Motor6D")
- Motor6D10 = Instance.new("Motor6D")
- Motor6D11 = Instance.new("Motor6D")
- Weld12 = Instance.new("Weld")
- Weld13 = Instance.new("Weld")
- Part14 = Instance.new("Part")
- Part15 = Instance.new("Part")
- Weld16 = Instance.new("Weld")
- Part17 = Instance.new("Part")
- Part18 = Instance.new("Part")
- Part19 = Instance.new("Part")
- Motor6D20 = Instance.new("Motor6D")
- Script21 = Instance.new("Script")
- StringValue22 = Instance.new("StringValue")
- Animation23 = Instance.new("Animation")
- StringValue24 = Instance.new("StringValue")
- Animation25 = Instance.new("Animation")
- StringValue26 = Instance.new("StringValue")
- Animation27 = Instance.new("Animation")
- NumberValue28 = Instance.new("NumberValue")
- Animation29 = Instance.new("Animation")
- NumberValue30 = Instance.new("NumberValue")
- StringValue31 = Instance.new("StringValue")
- Animation32 = Instance.new("Animation")
- StringValue33 = Instance.new("StringValue")
- Animation34 = Instance.new("Animation")
- StringValue35 = Instance.new("StringValue")
- Animation36 = Instance.new("Animation")
- StringValue37 = Instance.new("StringValue")
- Animation38 = Instance.new("Animation")
- Script39 = Instance.new("Script")
- Shirt40 = Instance.new("Shirt")
- Pants41 = Instance.new("Pants")
- Hat42 = Instance.new("Hat")
- Part43 = Instance.new("Part")
- SpecialMesh44 = Instance.new("SpecialMesh")
- Part45 = Instance.new("Part")
- Sound46 = Instance.new("Sound")
- Sound47 = Instance.new("Sound")
- Part48 = Instance.new("Part")
- SpecialMesh49 = Instance.new("SpecialMesh")
- Script50 = Instance.new("Script")
- Humanoid51 = Instance.new("Humanoid")
- Hat52 = Instance.new("Hat")
- Part53 = Instance.new("Part")
- SpecialMesh54 = Instance.new("SpecialMesh")
- Model0.Name = "Cleanup Crew"
- Model0.Parent = mas
- Model0.PrimaryPart = Part1
- Part1.Name = "Head"
- Part1.Parent = Model0
- Part1.BrickColor = BrickColor.new("Pastel brown")
- Part1.Rotation = Vector3.new(0, -90, 0)
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.Size = Vector3.new(2, 1, 1)
- Part1.CFrame = CFrame.new(12.4519968, 4.5, 63.8128319, -5.73683906e-07, -9.13071307e-09, -1, 7.667877e-09, 1, -9.13071752e-09, 1, -7.66788233e-09, -5.73683906e-07)
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.Color = Color3.new(1, 0.8, 0.6)
- Part1.Position = Vector3.new(12.4519968, 4.5, 63.8128319)
- Part1.Orientation = Vector3.new(0, -90, 0)
- Part1.Color = Color3.new(1, 0.8, 0.6)
- SpecialMesh2.Parent = Part1
- SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
- SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
- Sound3.Name = "Die"
- Sound3.Parent = Part1
- Sound3.Pitch = 1.1000000238419
- Sound3.SoundId = "rbxassetid://657622857"
- Sound3.Volume = 1
- Sound4.Name = "SeeEnemy"
- Sound4.Parent = Part1
- Sound4.SoundId = "rbxassetid://657622327"
- Sound4.Volume = 1
- Decal5.Parent = Part1
- Decal5.Texture = "http://www.roblox.com/asset/?id=41675658"
- Weld6.Name = "HeadWeld"
- Weld6.Parent = Part1
- Weld6.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld6.C1 = CFrame.new(0, -0.100000001, -0.0700000003, 1, 0, -0, 0, 0.980580688, 0.196116135, 0, -0.196116135, 0.980580688)
- Weld6.Part0 = Part1
- Weld6.Part1 = Part43
- Weld7.Name = "HeadWeld"
- Weld7.Parent = Part1
- Weld7.C0 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld7.C1 = CFrame.new(0, -0.100000001, -0.0700000003, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Weld7.Part0 = Part1
- Weld7.Part1 = Part53
- Part8.Name = "Torso"
- Part8.Parent = Model0
- Part8.BrickColor = BrickColor.new("Institutional white")
- Part8.Rotation = Vector3.new(0, -90, 0)
- Part8.FormFactor = Enum.FormFactor.Symmetric
- Part8.Size = Vector3.new(2, 2, 1)
- Part8.CFrame = CFrame.new(12.4519968, 2.99999976, 63.8128319, -5.73683906e-07, -9.13071307e-09, -1, 7.667877e-09, 1, -9.13071752e-09, 1, -7.66788233e-09, -5.73683906e-07)
- Part8.LeftSurface = Enum.SurfaceType.Weld
- Part8.RightSurface = Enum.SurfaceType.Weld
- Part8.Color = Color3.new(0.972549, 0.972549, 0.972549)
- Part8.Position = Vector3.new(12.4519968, 2.99999976, 63.8128319)
- Part8.Orientation = Vector3.new(0, -90, 0)
- Part8.Color = Color3.new(0.972549, 0.972549, 0.972549)
- Motor6D9.Name = "Right Hip"
- Motor6D9.Parent = Part8
- Motor6D9.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D9.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D9.Part0 = Part8
- Motor6D9.Part1 = Part18
- Motor6D9.MaxVelocity = 0.10000000149012
- Motor6D10.Name = "Left Hip"
- Motor6D10.Parent = Part8
- Motor6D10.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D10.C1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D10.Part0 = Part8
- Motor6D10.Part1 = Part17
- Motor6D10.MaxVelocity = 0.10000000149012
- Motor6D11.Name = "Neck"
- Motor6D11.Parent = Part8
- Motor6D11.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D11.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D11.Part0 = Part8
- Motor6D11.Part1 = Part1
- Motor6D11.MaxVelocity = 0.10000000149012
- Weld12.Parent = Part8
- Weld12.C1 = CFrame.new(-1.20000005, 0.5, 0.400000006, 0.99619472, 0, -0.087155737, 0.087155737, 1.19248806e-08, 0.99619472, 1.03932174e-09, -1, 1.18795027e-08)
- Weld12.Part0 = Part8
- Weld12.Part1 = Part15
- Weld13.Parent = Part8
- Weld13.C1 = CFrame.new(0.800000012, 0.5, 0.400000006, 0.766044438, 0, 0.642787576, -0.642787576, 1.19248806e-08, 0.766044438, -7.66516539e-09, -1, 9.13498877e-09)
- Weld13.Part0 = Part8
- Weld13.Part1 = Part14
- Part14.Name = "Left Arm"
- Part14.Parent = Model0
- Part14.BrickColor = BrickColor.new("Pastel brown")
- Part14.Rotation = Vector3.new(90, 0, 130)
- Part14.CanCollide = false
- Part14.FormFactor = Enum.FormFactor.Symmetric
- Part14.Size = Vector3.new(1, 2, 1)
- Part14.CFrame = CFrame.new(13.3492489, 3.39999986, 63.521389, -0.642787993, -0.76604408, -4.27125002e-12, 4.82280882e-12, 1.52944324e-12, -1, 0.76604408, -0.642787993, 2.71169719e-12)
- Part14.Color = Color3.new(1, 0.8, 0.6)
- Part14.Position = Vector3.new(13.3492489, 3.39999986, 63.521389)
- Part14.Orientation = Vector3.new(90, -130, 0)
- Part14.Color = Color3.new(1, 0.8, 0.6)
- Part15.Name = "Right Arm"
- Part15.Parent = Model0
- Part15.BrickColor = BrickColor.new("Pastel brown")
- Part15.Rotation = Vector3.new(90, 0, 85)
- Part15.CanCollide = false
- Part15.FormFactor = Enum.FormFactor.Symmetric
- Part15.Size = Vector3.new(1, 2, 1)
- Part15.CFrame = CFrame.new(13.0546808, 3.39999986, 64.9646912, 0.0871551633, -0.99619478, -2.74879053e-09, 8.4344931e-09, 3.49720697e-09, -1, 0.99619478, 0.0871551633, 8.70719674e-09)
- Part15.Color = Color3.new(1, 0.8, 0.6)
- Part15.Position = Vector3.new(13.0546808, 3.39999986, 64.9646912)
- Part15.Orientation = Vector3.new(90, -85, 0)
- Part15.Color = Color3.new(1, 0.8, 0.6)
- Weld16.Name = "RightGrip"
- Weld16.Parent = Part15
- Weld16.C0 = CFrame.new(0, -1, 0, 1, 0, -0, 0, 0, 1, 0, -1, 0)
- Weld16.C1 = CFrame.new(0, -0.200000003, 0.200000003, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Weld16.Part0 = Part15
- Weld16.Part1 = Part45
- Part17.Name = "Left Leg"
- Part17.Parent = Model0
- Part17.BrickColor = BrickColor.new("Institutional white")
- Part17.Rotation = Vector3.new(0, -90, 0)
- Part17.CanCollide = false
- Part17.FormFactor = Enum.FormFactor.Symmetric
- Part17.Size = Vector3.new(1, 2, 1)
- Part17.CFrame = CFrame.new(12.4519968, 0.999999762, 63.3128319, -5.73683906e-07, -9.13071307e-09, -1, 7.667877e-09, 1, -9.13071752e-09, 1, -7.66788233e-09, -5.73683906e-07)
- Part17.BottomSurface = Enum.SurfaceType.Smooth
- Part17.Color = Color3.new(0.972549, 0.972549, 0.972549)
- Part17.Position = Vector3.new(12.4519968, 0.999999762, 63.3128319)
- Part17.Orientation = Vector3.new(0, -90, 0)
- Part17.Color = Color3.new(0.972549, 0.972549, 0.972549)
- Part18.Name = "Right Leg"
- Part18.Parent = Model0
- Part18.BrickColor = BrickColor.new("Institutional white")
- Part18.Rotation = Vector3.new(0, -90, 0)
- Part18.CanCollide = false
- Part18.FormFactor = Enum.FormFactor.Symmetric
- Part18.Size = Vector3.new(1, 2, 1)
- Part18.CFrame = CFrame.new(12.4519968, 0.999999762, 64.3128357, -5.73683906e-07, -9.13071307e-09, -1, 7.667877e-09, 1, -9.13071752e-09, 1, -7.66788233e-09, -5.73683906e-07)
- Part18.BottomSurface = Enum.SurfaceType.Smooth
- Part18.Color = Color3.new(0.972549, 0.972549, 0.972549)
- Part18.Position = Vector3.new(12.4519968, 0.999999762, 64.3128357)
- Part18.Orientation = Vector3.new(0, -90, 0)
- Part18.Color = Color3.new(0.972549, 0.972549, 0.972549)
- Part19.Name = "HumanoidRootPart"
- Part19.Parent = Model0
- Part19.BrickColor = BrickColor.new("Bright blue")
- Part19.Transparency = 1
- Part19.Rotation = Vector3.new(0, -90, 0)
- Part19.FormFactor = Enum.FormFactor.Symmetric
- Part19.Size = Vector3.new(2, 2, 1)
- Part19.CFrame = CFrame.new(12.4519968, 2.99999976, 63.8128319, -5.73683906e-07, -9.13071307e-09, -1, 7.667877e-09, 1, -9.13071752e-09, 1, -7.66788233e-09, -5.73683906e-07)
- Part19.BottomSurface = Enum.SurfaceType.Smooth
- Part19.TopSurface = Enum.SurfaceType.Smooth
- Part19.Color = Color3.new(0.0509804, 0.411765, 0.67451)
- Part19.Position = Vector3.new(12.4519968, 2.99999976, 63.8128319)
- Part19.Orientation = Vector3.new(0, -90, 0)
- Part19.Color = Color3.new(0.0509804, 0.411765, 0.67451)
- Motor6D20.Name = "RootJoint"
- Motor6D20.Parent = Part19
- Motor6D20.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D20.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D20.Part0 = Part19
- Motor6D20.Part1 = Part8
- Motor6D20.MaxVelocity = 0.10000000149012
- Script21.Name = "Animate"
- Script21.Parent = Model0
- table.insert(cors,sandbox(Script21,function()
- wait(5)
- 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 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 oldAnimTrack = nil
- 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 }
- },
- 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, laugh = false, cheer = false}
- math.randomseed(tick())
- -- Setup animation objects
- for name, fileList in pairs(animNames) do
- animTable[name] = {}
- animTable[name].count = 0
- animTable[name].totalWeight = 0
- -- check for config values
- local config = script:FindFirstChild(name)
- if (config ~= nil) then
- -- print("Loading anims " .. name)
- local idx = 1
- for _, childPart in pairs(config:GetChildren()) do
- 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
- -- 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
- -- ANIMATION
- -- declarations
- local toolAnim = "None"
- local toolAnimTime = 0
- local jumpAnimTime = 0
- local jumpAnimDuration = 0.175
- local toolTransitionTime = 0.1
- local fallTransitionTime = 0.2
- 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 (oldAnimTrack ~= nil) then
- oldAnimTrack:Stop()
- oldAnimTrack:Destroy()
- oldAnimTrack = nil
- end
- if (currentAnimTrack ~= nil) then
- currentAnimTrack:Stop()
- currentAnimTrack:Destroy()
- currentAnimTrack = nil
- end
- return oldAnim
- end
- function keyFrameReachedFunc(frameName)
- if (frameName == "End") then
- -- print("Keyframe : ".. frameName)
- local repeatAnim = stopAllAnimations()
- playAnimation(repeatAnim, 0.0, Humanoid)
- end
- end
- -- Preload animations
- function playAnimation(animName, transitionTime, humanoid)
- if (animName ~= currentAnim) then
- if (oldAnimTrack ~= nil) then
- oldAnimTrack:Stop()
- oldAnimTrack:Destroy()
- 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
- oldAnimTrack = currentAnimTrack
- 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 toolOldAnimTrack = nil
- 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
- toolOldAnimTrack = toolAnimTrack
- 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 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()
- playAnimation("climb", 0.1, Humanoid)
- 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()
- 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)
- 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))
- StringValue22.Name = "climb"
- StringValue22.Parent = Script21
- Animation23.Name = "ClimbAnim"
- Animation23.Parent = StringValue22
- Animation23.AnimationId = "http://www.roblox.com/asset/?id=125750800"
- StringValue24.Name = "fall"
- StringValue24.Parent = Script21
- Animation25.Name = "FallAnim"
- Animation25.Parent = StringValue24
- Animation25.AnimationId = "http://www.roblox.com/asset/?id=125750759"
- StringValue26.Name = "idle"
- StringValue26.Parent = Script21
- Animation27.Name = "Animation1"
- Animation27.Parent = StringValue26
- Animation27.AnimationId = "http://www.roblox.com/asset/?id=125750544"
- NumberValue28.Name = "Weight"
- NumberValue28.Parent = Animation27
- NumberValue28.Value = 9
- Animation29.Name = "Animation2"
- Animation29.Parent = StringValue26
- Animation29.AnimationId = "http://www.roblox.com/asset/?id=125750618"
- NumberValue30.Name = "Weight"
- NumberValue30.Parent = Animation29
- NumberValue30.Value = 1
- StringValue31.Name = "jump"
- StringValue31.Parent = Script21
- Animation32.Name = "JumpAnim"
- Animation32.Parent = StringValue31
- Animation32.AnimationId = "http://www.roblox.com/asset/?id=125750702"
- StringValue33.Name = "run"
- StringValue33.Parent = Script21
- Animation34.Name = "RunAnim"
- Animation34.Parent = StringValue33
- Animation34.AnimationId = "http://www.roblox.com/asset/?id=125749145"
- StringValue35.Name = "toolnone"
- StringValue35.Parent = Script21
- Animation36.Name = "ToolNoneAnim"
- Animation36.Parent = StringValue35
- Animation36.AnimationId = "http://www.roblox.com/asset/?id=125750867"
- StringValue37.Name = "walk"
- StringValue37.Parent = Script21
- Animation38.Name = "WalkAnim"
- Animation38.Parent = StringValue37
- Animation38.AnimationId = "http://www.roblox.com/asset/?id=125749145"
- Script39.Name = "Control"
- Script39.Parent = Model0
- table.insert(cors,sandbox(Script39,function()
- wait(.1)
- local ammo=29
- local w=.14
- local r=false
- local t=script.Parent
- Spawn(function()
- local c=t:Clone()
- t.Humanoid.Died:wait()
- t.Handle:Destroy()
- script.Parent.Head.Die:Play()
- wait(3)
- c.Parent=workspace
- c:MakeJoints()
- t:Destroy()
- end)
- local cf={CFrame.new(.8,.5,.4)*CFrame.Angles(math.rad(270),math.rad(40),0),CFrame.new(-1.2,0.5,0.4)*CFrame.Angles(math.rad(270),math.rad(-5),0)}
- local c=LoadLibrary'RbxUtility'.Create
- local b1=c'Part'{TopSurface=0;BottomSurface=0;Anchored=true;CanCollide=false;Material="Neon";Transparency=0.3;BrickColor=BrickColor.Yellow();Size=Vector3.new(.2,.2,1);c'BlockMesh'{Scale=Vector3.new(.2,.2,1)}}
- local b2=b1:Clone()
- b1.Name,b2.Name='1','2'
- local mov=c'Part'{Transparency=1;CanCollide=false;Parent=t;Anchored=true}
- local h=t:WaitForChild'Handle'
- local function reload(boo)
- if(boo and ammo~=30)or ammo==0 then
- r=true
- if w then
- w=.03
- end
- h.Reload:Play()
- wait(3)
- ammo=30
- if w then
- w=.14
- end
- r=false
- elseif boo then
- wait(.1)
- end
- end
- local function near()
- local dis,pl=200,nil
- for _,v in ipairs(game.Players:GetPlayers())do
- if v.Character and v.Character:FindFirstChild'Humanoid'and v:DistanceFromCharacter(h.Position)<dis then
- dis,pl=v:DistanceFromCharacter(h.Position),v
- end
- end
- if pl then
- return pl.Character:GetModelCFrame(),dis,CFrame.new(pl.Character.Humanoid.WalkToPoint).lookVector
- else
- return nil
- end
- end
- Spawn(function()
- while true do
- t.Humanoid.Jump=true
- while not w do wait(4)end
- for i=1,math.random(150,160)do
- wait(w)
- end
- end
- end)
- Spawn(function()
- while wait(math.random(2,7)/10)do
- local n=near()
- if n and math.random(1,7)==2 or not n then
- mov.CFrame=t.Torso.CFrame+t.Torso.CFrame.lookVector*Vector3.new(math.random(-50,50),0,math.random(-35,50))
- else
- mov.CFrame=n+Vector3.new((math.random(1,2)==1 and 1 or -1)*math.random(25,50),0,(math.random(1,2)==1 and 1 or -1)*math.random(25,50))
- end
- wait(0.4)
- t.Humanoid:MoveTo(mov.Position,mov)
- end
- end)
- while true do
- local n,mag,hum=near()
- if n then
- n=n.p
- if not r then
- w=.0001
- local dir=h.Position-n
- local tst,_=workspace:FindPartOnRay(Ray.new(t.Torso.Position,(n-t.Torso.Position).Unit*99999),t)
- local aim=n+Vector3.new(math.random(-mag*.008,mag*.008),math.random(-mag*.009,mag*.009),math.random(-mag*.1,mag*.1))*(2+math.random())+hum
- if tst and tst.Parent and game.Players:GetPlayerFromCharacter(tst.Parent)then
- wait(0.04)
- h.Fire:Play()
- local par,pos=workspace:FindPartOnRay(Ray.new(h.Position,(aim-h.Position).Unit*99999),t)
- if par then
- local h=par.Parent:FindFirstChild'Humanoid'or par.Parent.Parent:FindFirstChild'Humanoid'
- if h and h.Health-10>0 then
- h.Health=h.Health-10
- elseif h then
- h.Health=0
- h.Parent:BreakJoints()
- end
- end
- ammo=ammo-1
- mag=(h.Position-pos).magnitude
- b1.Parent,b2.Parent=t,t
- b1.CFrame,b2.CFrame=CFrame.new(h.Position:Lerp(pos,.375),pos),CFrame.new(pos:Lerp(h.Position,.125),h.Position)
- b1.Mesh.Scale,b2.Mesh.Scale=Vector3.new(.2,.2,mag*.75),Vector3.new(.2,.2,mag/4)
- Delay(.03,function()b1.Parent=nil wait(.03)b2.Parent=nil end)
- end
- wait(.05)
- if ammo==0 then
- reload()
- end
- end
- else
- reload(true)
- w=false
- end
- end
- end))
- Shirt40.Name = "Shirt"
- Shirt40.Parent = Model0
- Shirt40.ShirtTemplate = "http://www.roblox.com/asset/?id=26349286"
- Pants41.Name = "Pants"
- Pants41.Parent = Model0
- Pants41.PantsTemplate = "http://www.roblox.com/asset/?id=26349271"
- Hat42.Name = "Helm"
- Hat42.Parent = Model0
- Hat42.AttachmentForward = Vector3.new(0, -0.196116135, -0.980580688)
- Hat42.AttachmentPos = Vector3.new(0, -0.100000001, -0.0700000003)
- Hat42.AttachmentUp = Vector3.new(0, 0.980580688, -0.196116135)
- Part43.Name = "Handle"
- Part43.Parent = Hat42
- Part43.Material = Enum.Material.CorrodedMetal
- Part43.BrickColor = BrickColor.new("Black")
- Part43.Rotation = Vector3.new(90, -78.6899948, 90)
- Part43.CanCollide = false
- Part43.FormFactor = Enum.FormFactor.Symmetric
- Part43.Size = Vector3.new(1, 1, 1)
- Part43.CFrame = CFrame.new(12.3637447, 5.08433008, 63.8128319, -5.73683906e-07, -0.196116149, -0.980580688, 7.667877e-09, 0.980580688, -0.196116149, 1, -1.2002765e-07, -5.61039542e-07)
- Part43.BottomSurface = Enum.SurfaceType.Smooth
- Part43.TopSurface = Enum.SurfaceType.Smooth
- Part43.Color = Color3.new(0.164706, 0.176471, 0.0823529)
- Part43.Position = Vector3.new(12.3637447, 5.08433008, 63.8128319)
- Part43.Orientation = Vector3.new(11.3099995, -90, 0)
- Part43.Color = Color3.new(0.164706, 0.176471, 0.0823529)
- SpecialMesh44.Parent = Part43
- SpecialMesh44.MeshId = "http://www.roblox.com/asset/?id=45609892"
- SpecialMesh44.Offset = Vector3.new(0, 0.0500000007, -0.150000006)
- SpecialMesh44.Scale = Vector3.new(1.5, 1.5, 1.5)
- SpecialMesh44.MeshType = Enum.MeshType.FileMesh
- SpecialMesh44.Scale = Vector3.new(1.5, 1.5, 1.5)
- Part45.Name = "Handle"
- Part45.Parent = Model0
- Part45.BrickColor = BrickColor.new("Dark stone grey")
- Part45.Transparency = 1
- Part45.Rotation = Vector3.new(0, 5, 0)
- Part45.CanCollide = false
- Part45.FormFactor = Enum.FormFactor.Symmetric
- Part45.Size = Vector3.new(2, 1, 1)
- Part45.CFrame = CFrame.new(14.0334444, 3.5999999, 64.678299, 0.99619478, 2.74879053e-09, 0.0871551633, -3.49720697e-09, 1, 8.4344931e-09, -0.0871551633, -8.70719674e-09, 0.99619478)
- Part45.RightSurface = Enum.SurfaceType.Hinge
- Part45.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part45.Position = Vector3.new(14.0334444, 3.5999999, 64.678299)
- Part45.Orientation = Vector3.new(0, 5, 0)
- Part45.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Sound46.Name = "Reload"
- Sound46.Parent = Part45
- Sound46.Pitch = 0.80000001192093
- Sound46.SoundId = "rbxassetid://657701831"
- Sound46.Volume = 1
- Sound47.Name = "Fire"
- Sound47.Parent = Part45
- Sound47.SoundId = "rbxassetid://541454470"
- Sound47.Volume = 1
- Part48.Parent = Part45
- Part48.Rotation = Vector3.new(-5, -90, 0)
- Part48.Size = Vector3.new(0.299999595, 1, 2)
- Part48.CFrame = CFrame.new(14.380682, 3.71998262, 64.4170761, -9.3130501e-07, 7.96250106e-08, -1, 0.087155737, 0.99619478, -1.84656812e-09, 0.99619472, -0.0871557444, -9.34700893e-07)
- Part48.Position = Vector3.new(14.380682, 3.71998262, 64.4170761)
- Part48.Orientation = Vector3.new(0, -90, 5)
- SpecialMesh49.Parent = Part48
- SpecialMesh49.MeshId = "rbxassetid://477918514"
- SpecialMesh49.Scale = Vector3.new(0.0299999993, 0.0299999993, 0.0299999993)
- SpecialMesh49.TextureId = "rbxassetid://477918517"
- SpecialMesh49.MeshType = Enum.MeshType.FileMesh
- SpecialMesh49.Scale = Vector3.new(0.0299999993, 0.0299999993, 0.0299999993)
- Script50.Name = "qPerfectionWeld"
- Script50.Parent = Part45
- table.insert(cors,sandbox(Script50,function()
- -- Created by Quenty (@Quenty, follow me on twitter).
- -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
- -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
- --[[ INSTRUCTIONS
- - Place in the model
- - Make sure model is anchored
- - That's it. It will weld the model and all children.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes.
- ]]
- --[[ DOCUMENTATION
- - Will work in tools. If ran more than once it will not create more than one weld. This is especially useful for tools that are dropped and then picked up again.
- - Will work in PBS servers
- - Will work as long as it starts out with the part anchored
- - Stores the relative CFrame as a CFrame value
- - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
- - Utilizes a recursive algorith to find all parts in the model
- - Will reweld on script reparent if the script is initially parented to a tool.
- - Welds as fast as possible
- ]]
- -- qPerfectionWeld.lua
- -- Created 10/6/2014
- -- Author: Quenty
- -- Version 1.0.3
- -- Updated 10/14/2014 - Updated to 1.0.1
- --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
- -- Updated 10/14/2014 - Updated to 1.0.2
- --- Fixed bug fix.
- -- Updated 10/14/2014 - Updated to 1.0.3
- --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
- local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
- local function CallOnChildren(Instance, FunctionToCall)
- -- Calls a function on each of the children of a certain object, using recursion.
- FunctionToCall(Instance)
- for _, Child in next, Instance:GetChildren() do
- CallOnChildren(Child, FunctionToCall)
- end
- end
- local function GetNearestParent(Instance, ClassName)
- -- Returns the nearest parent of a certain class, or returns nil
- local Ancestor = Instance
- repeat
- Ancestor = Ancestor.Parent
- if Ancestor == nil then
- return nil
- end
- until Ancestor:IsA(ClassName)
- return Ancestor
- end
- local function GetBricks(StartInstance)
- local List = {}
- -- if StartInstance:IsA("BasePart") then
- -- List[#List+1] = StartInstance
- -- end
- CallOnChildren(StartInstance, function(Item)
- if Item:IsA("BasePart") then
- List[#List+1] = Item;
- end
- end)
- return List
- end
- local function Modify(Instance, Values)
- -- Modifies an Instance by using a table.
- assert(type(Values) == "table", "Values is not a table");
- for Index, Value in next, Values do
- if type(Index) == "number" then
- Value.Parent = Instance
- else
- Instance[Index] = Value
- end
- end
- return Instance
- end
- local function Make(ClassType, Properties)
- -- Using a syntax hack to create a nice way to Make new items.
- return Modify(Instance.new(ClassType), Properties)
- end
- local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
- local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
- local function HasWheelJoint(Part)
- for _, SurfaceName in pairs(Surfaces) do
- for _, HingSurfaceName in pairs(HingSurfaces) do
- if Part[SurfaceName].Name == HingSurfaceName then
- return true
- end
- end
- end
- return false
- end
- local function ShouldBreakJoints(Part)
- --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
- -- definitely some edge cases.
- if NEVER_BREAK_JOINTS then
- return false
- end
- if HasWheelJoint(Part) then
- return false
- end
- local Connected = Part:GetConnectedParts()
- if #Connected == 1 then
- return false
- end
- for _, Item in pairs(Connected) do
- if HasWheelJoint(Item) then
- return false
- elseif not Item:IsDescendantOf(script.Parent) then
- return false
- end
- end
- return true
- end
- local function WeldTogether(Part0, Part1, JointType, WeldParent)
- --- Weld's 2 parts together
- -- @param Part0 The first part
- -- @param Part1 The second part (Dependent part most of the time).
- -- @param [JointType] The type of joint. Defaults to weld.
- -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
- -- @return The weld created.
- JointType = JointType or "Weld"
- local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
- local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
- Modify(NewWeld, {
- Name = "qCFrameWeldThingy";
- Part0 = Part0;
- Part1 = Part1;
- C0 = CFrame.new();--Part0.CFrame:inverse();
- C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
- Parent = Part1;
- })
- if not RelativeValue then
- RelativeValue = Make("CFrameValue", {
- Parent = Part1;
- Name = "qRelativeCFrameWeldValue";
- Archivable = true;
- Value = NewWeld.C1;
- })
- end
- return NewWeld
- end
- local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
- -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
- -- @param MainPart The part to weld the model to (can be in the model).
- -- @param [JointType] The type of joint. Defaults to weld.
- -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
- for _, Part in pairs(Parts) do
- if ShouldBreakJoints(Part) then
- Part:BreakJoints()
- end
- end
- for _, Part in pairs(Parts) do
- if Part ~= MainPart then
- WeldTogether(MainPart, Part, JointType, MainPart)
- end
- end
- if not DoNotUnanchor then
- for _, Part in pairs(Parts) do
- Part.Anchored = false
- end
- MainPart.Anchored = false
- end
- end
- local function PerfectionWeld()
- local Tool = GetNearestParent(script, "Tool")
- local Parts = GetBricks(script.Parent)
- local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
- if PrimaryPart then
- WeldParts(Parts, PrimaryPart, "Weld", false)
- else
- warn("qWeld - Unable to weld part")
- end
- return Tool
- end
- local Tool = PerfectionWeld()
- if Tool and script.ClassName == "Script" then
- --- Don't bother with local scripts
- script.Parent.AncestryChanged:connect(function()
- PerfectionWeld()
- end)
- end
- -- Created by Quenty (@Quenty, follow me on twitter).
- end))
- Humanoid51.Parent = Model0
- Humanoid51.NameOcclusion = Enum.NameOcclusion.NoOcclusion
- Humanoid51.RightLeg = Part18
- Humanoid51.LeftLeg = Part17
- Humanoid51.Torso = Part19
- Hat52.Name = "Millitary Beanie"
- Hat52.Parent = Model0
- Hat52.AttachmentPos = Vector3.new(0, -0.100000001, -0.0700000003)
- Part53.Name = "Handle"
- Part53.Parent = Hat52
- Part53.BrickColor = BrickColor.new("Pastel brown")
- Part53.Rotation = Vector3.new(0, -90, 0)
- Part53.CanCollide = false
- Part53.FormFactor = Enum.FormFactor.Symmetric
- Part53.Size = Vector3.new(1, 1, 1)
- Part53.CFrame = CFrame.new(12.3819971, 5.0999999, 63.8128319, -5.73683906e-07, -9.13071307e-09, -1, 7.667877e-09, 1, -9.13071752e-09, 1, -7.66788233e-09, -5.73683906e-07)
- Part53.BottomSurface = Enum.SurfaceType.Smooth
- Part53.TopSurface = Enum.SurfaceType.Smooth
- Part53.Color = Color3.new(1, 0.8, 0.6)
- Part53.Position = Vector3.new(12.3819971, 5.0999999, 63.8128319)
- Part53.Orientation = Vector3.new(0, -90, 0)
- Part53.Color = Color3.new(1, 0.8, 0.6)
- SpecialMesh54.Parent = Part53
- SpecialMesh54.MeshId = "rbxassetid://11349749"
- SpecialMesh54.Offset = Vector3.new(0, -0.400000006, -0.300000012)
- SpecialMesh54.TextureId = "rbxassetid://29875340"
- SpecialMesh54.MeshType = Enum.MeshType.FileMesh
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = workspace
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement