Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Converted using Mokiros's Model to Script plugin
- -- Converted string size: 11412
- local genv={}
- local Scripts = {
- 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;
- for _,Child in pairs(Figure:GetChildren())do
- if Child and Child.ClassName=="Humanoid"then
- Humanoid=Child;
- end;
- end;
- local pose = "Standing"
- local currentAnim = ""
- local currentAnimInstance = nil
- local currentAnimTrack = nil
- local currentAnimKeyframeHandler = nil
- local currentAnimSpeed = 1.0
- local animTable = {}
- local animNames = {
- idle = {
- { id = "http://www.roblox.com/asset/?id=180435571", weight = 9 },
- { id = "http://www.roblox.com/asset/?id=180435792", weight = 1 }
- },
- walk = {
- { id = "http://www.roblox.com/asset/?id=180426354", 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=180436148", weight = 10 }
- },
- climb = {
- { id = "http://www.roblox.com/asset/?id=180436334", weight = 10 }
- },
- sit = {
- { id = "http://www.roblox.com/asset/?id=178130996", weight = 10 }
- },
- toolnone = {
- { id = "http://www.roblox.com/asset/?id=182393478", 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 }
- },
- dance1 = {
- { id = "http://www.roblox.com/asset/?id=182435998", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491037", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491065", weight = 10 }
- },
- dance2 = {
- { id = "http://www.roblox.com/asset/?id=182436842", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491248", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491277", weight = 10 }
- },
- dance3 = {
- { id = "http://www.roblox.com/asset/?id=182436935", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491368", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491423", weight = 10 }
- },
- laugh = {
- { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
- },
- cheer = {
- { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
- },
- }
- local dances = {"dance1", "dance2", "dance3"}
- -- 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, dance1 = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
- 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 = ""
- currentAnimInstance = nil
- 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
- local repeatAnim = currentAnim
- -- return to idle if finishing an emote
- if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
- repeatAnim = "idle"
- end
- local animSpeed = currentAnimSpeed
- playAnimation(repeatAnim, 0.0, Humanoid)
- setAnimationSpeed(animSpeed)
- end
- end
- -- Preload animations
- function playAnimation(animName, transitionTime, humanoid)
- 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
- -- switch animation
- if (anim ~= currentAnimInstance) then
- if (currentAnimTrack ~= nil) then
- currentAnimTrack:Stop(transitionTime)
- currentAnimTrack:Destroy()
- end
- currentAnimSpeed = 1.0
- -- load it to the humanoid; get AnimationTrack
- currentAnimTrack = humanoid:LoadAnimation(anim)
- -- play the animation
- currentAnimTrack:Play(transitionTime)
- currentAnim = animName
- currentAnimInstance = anim
- -- 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 toolAnimInstance = nil
- local currentToolAnimKeyframeHandler = nil
- function toolKeyFrameReachedFunc(frameName)
- if (frameName == "End") then
- --print("Keyframe : ".. frameName)
- playToolAnimation(toolAnimName, 0.0, Humanoid)
- end
- end
- function playToolAnimation(animName, transitionTime, humanoid)
- 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
- if (toolAnimInstance ~= anim) then
- if (toolAnimTrack ~= nil) then
- toolAnimTrack:Stop()
- toolAnimTrack:Destroy()
- transitionTime = 0
- end
- -- load it to the humanoid; get AnimationTrack
- toolAnimTrack = humanoid:LoadAnimation(anim)
- -- play the animation
- toolAnimTrack:Play(transitionTime)
- toolAnimName = animName
- toolAnimInstance = anim
- currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
- end
- end
- function stopToolAnimations()
- local oldAnim = toolAnimName
- if (currentToolAnimKeyframeHandler ~= nil) then
- currentToolAnimKeyframeHandler:disconnect()
- end
- toolAnimName = ""
- toolAnimInstance = nil
- 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)
- if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
- setAnimationSpeed(speed / 14.5)
- end
- 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
- playAnimation("sit", 0.5, Humanoid)
- 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
- stopAllAnimations()
- amplitude = 0.1
- frequency = 1
- setAngles = true
- end
- if (setAngles) then
- local 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 and tool:FindFirstChild("Handle") then
- local 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"
- toolAnimInstance = nil
- 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)
- local runService = game:GetService("RunService");
- playAnimation("idle", 0.1, Humanoid)
- pose = "Standing"
- while Wait(0)do
- local _,time=wait(0)
- move(time)
- end end;
- function() function MakeBlood()
- local blood = Instance.new("Part")
- blood.formFactor = "Plate"
- blood.Size = Vector3.new(1,0.4,1)
- blood.Name = "Blood"
- blood.BrickColor = BrickColor.new("Really red")
- blood.Locked = true
- blood.BackSurface = "Smooth"
- blood.TopSurface = "Smooth"
- blood.CanCollide = true
- local CC = math.random(1,2)
- if CC == 1 then
- blood.Transparency = 0.5
- elseif CC == 2 then
- blood.Transparency = 0.3
- end
- blood.Position = script.Parent.Torso.Position
- blood.Parent = script.Parent
- end
- humanoid = script.Parent.Humanoid
- lhh = humanoid.Health
- while true do
- if humanoid.Health < lhh then
- howmuch = math.random(4,7)
- lhh = humanoid.Health
- for i = 1 , howmuch do
- MakeBlood()
- end
- end
- wait(0.1)
- end
- end;
- function() --[[ By: Brutez, 2/28/2015, 1:34 AM, (UTC-08:00) Pacific Time (US & Canada) ]]--
- local AdvancedRespawnScript=script;
- local Bob=AdvancedRespawnScript.Parent;
- local GameDerbis=Game:GetService("Debris");
- repeat Wait(0)until script and script.Parent and script.Parent.ClassName=="Model";
- local BobHumanoid;
- for _,Child in pairs(Bob:GetChildren())do
- if Child and Child.ClassName=="Humanoid"and Child.Health>0.001 then
- BobHumanoid=Child;
- end;
- end;
- local Respawndant=Bob:Clone();
- coroutine.resume(coroutine.create(function()
- if Bob and BobHumanoid and BobHumanoid:FindFirstChild("Status")and not BobHumanoid:FindFirstChild("Status"):FindFirstChild("AvalibleSpawns")then
- SpawnModel=Instance.new("Model");
- SpawnModel.Parent=BobHumanoid:FindFirstChild("Status");
- SpawnModel.Name="AvalibleSpawns";
- else
- SpawnModel=BobHumanoid:FindFirstChild("Status"):FindFirstChild("AvalibleSpawns");
- end;
- function FindSpawn(SearchValue)
- local PartsArchivable=SearchValue:GetChildren();
- for AreaSearch=1,#PartsArchivable do
- if PartsArchivable[AreaSearch].className=="SpawnLocation"then
- local PositionValue=Instance.new("Vector3Value",SpawnModel);
- PositionValue.Value=PartsArchivable[AreaSearch].Position;
- PositionValue.Name=PartsArchivable[AreaSearch].Duration;
- end;
- FindSpawn(PartsArchivable[AreaSearch]);
- end;
- end;
- FindSpawn(Game.Workspace);
- local SpawnChilden=SpawnModel:GetChildren();
- if#SpawnChilden>0 then
- local SpawnItself=SpawnChilden[math.random(1,#SpawnChilden)];
- local RespawningForceField=Instance.new("ForceField");
- RespawningForceField.Parent=Bob;
- RespawningForceField.Name="SpawnForceField";
- GameDerbis:AddItem(RespawningForceField,SpawnItself.Name);
- Bob:MoveTo(SpawnItself.Value+Vector3.new(0,3.5,0));
- else
- if Bob:FindFirstChild("SpawnForceField")then
- Bob:FindFirstChild("SpawnForceField"):Destroy();
- end;
- Bob:MoveTo(Vector3.new(0,115,0));
- end;
- end));
- function Respawn()
- Wait(5);
- Respawndant.Parent=Bob.Parent;
- Respawndant:MakeJoints();
- Respawndant:FindFirstChild("Head"):MakeJoints();
- Respawndant:FindFirstChild("Torso"):MakeJoints();
- Bob:remove();
- end;
- BobHumanoid.Died:connect(Respawn);
- --[[ By: Brutez, 2/28/2015, 1:34 AM, (UTC-08:00) Pacific Time (US & Canada) ]]-- end;
- 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 currentAnimInstance = nil
- local currentAnimTrack = nil
- local currentAnimKeyframeHandler = nil
- local currentAnimSpeed = 1.0
- local animTable = {}
- local animNames = {
- idle = {
- { id = "http://www.roblox.com/asset/?id=180435571", weight = 9 },
- { id = "http://www.roblox.com/asset/?id=180435792", weight = 1 }
- },
- walk = {
- { id = "http://www.roblox.com/asset/?id=180426354", 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=180436148", weight = 10 }
- },
- climb = {
- { id = "http://www.roblox.com/asset/?id=180436334", weight = 10 }
- },
- sit = {
- { id = "http://www.roblox.com/asset/?id=178130996", weight = 10 }
- },
- toolnone = {
- { id = "http://www.roblox.com/asset/?id=182393478", 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 }
- },
- dance1 = {
- { id = "http://www.roblox.com/asset/?id=182435998", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491037", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491065", weight = 10 }
- },
- dance2 = {
- { id = "http://www.roblox.com/asset/?id=182436842", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491248", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491277", weight = 10 }
- },
- dance3 = {
- { id = "http://www.roblox.com/asset/?id=182436935", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491368", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=182491423", weight = 10 }
- },
- laugh = {
- { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
- },
- cheer = {
- { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
- },
- }
- local dances = {"dance1", "dance2", "dance3"}
- -- 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, dance1 = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
- 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 = ""
- currentAnimInstance = nil
- 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
- local repeatAnim = currentAnim
- -- return to idle if finishing an emote
- if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
- repeatAnim = "idle"
- end
- local animSpeed = currentAnimSpeed
- playAnimation(repeatAnim, 0.0, Humanoid)
- setAnimationSpeed(animSpeed)
- end
- end
- -- Preload animations
- function playAnimation(animName, transitionTime, humanoid)
- 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
- -- switch animation
- if (anim ~= currentAnimInstance) then
- if (currentAnimTrack ~= nil) then
- currentAnimTrack:Stop(transitionTime)
- currentAnimTrack:Destroy()
- end
- currentAnimSpeed = 1.0
- -- load it to the humanoid; get AnimationTrack
- currentAnimTrack = humanoid:LoadAnimation(anim)
- -- play the animation
- currentAnimTrack:Play(transitionTime)
- currentAnim = animName
- currentAnimInstance = anim
- -- 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 toolAnimInstance = nil
- local currentToolAnimKeyframeHandler = nil
- function toolKeyFrameReachedFunc(frameName)
- if (frameName == "End") then
- -- print("Keyframe : ".. frameName)
- playToolAnimation(toolAnimName, 0.0, Humanoid)
- end
- end
- function playToolAnimation(animName, transitionTime, humanoid)
- 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
- if (toolAnimInstance ~= anim) then
- if (toolAnimTrack ~= nil) then
- toolAnimTrack:Stop()
- toolAnimTrack:Destroy()
- transitionTime = 0
- end
- -- load it to the humanoid; get AnimationTrack
- toolAnimTrack = humanoid:LoadAnimation(anim)
- -- play the animation
- toolAnimTrack:Play(transitionTime)
- toolAnimName = animName
- toolAnimInstance = anim
- currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
- end
- end
- function stopToolAnimations()
- local oldAnim = toolAnimName
- if (currentToolAnimKeyframeHandler ~= nil) then
- currentToolAnimKeyframeHandler:disconnect()
- end
- toolAnimName = ""
- toolAnimInstance = nil
- 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)
- if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
- setAnimationSpeed(speed / 14.5)
- end
- 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
- playAnimation("sit", 0.5, Humanoid)
- 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)
- stopAllAnimations()
- 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 and tool:FindFirstChild("Handle") 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"
- toolAnimInstance = nil
- 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)
- -- setup emote chat hook
- game.Players.LocalPlayer.Chatted:connect(function(msg)
- local emote = ""
- if msg == "/e dance" then
- emote = dances[math.random(1, #dances)]
- elseif (string.sub(msg, 1, 3) == "/e ") then
- emote = string.sub(msg, 4)
- elseif (string.sub(msg, 1, 7) == "/emote ") then
- emote = string.sub(msg, 8)
- end
- if (pose == "Standing" and emoteNames[emote] ~= nil) then
- playAnimation(emote, 0.1, Humanoid)
- end
- end)
- -- 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;
- 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;
- 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;
- 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;
- 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;
- 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;
- 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;
- function() ragdollS = true
- -- Load config
- config = script.Config
- ahd = config.Auto_Head_Decap.Value
- gore = config.Gore.Value
- bod = config.Blood_On_Death.Value
- Character = script.Parent
- Humanoid = Character.Humanoid
- Torso = Character.Torso
- function OnDeath()
- Humanoid.Parent = nil
- if Torso then
- Torso.Parent = game.Workspace
- local Head = Character:FindFirstChild("Head")
- if Head then
- Head.Parent = game.Workspace
- local Neck = Instance.new("Weld")
- Neck.Name = "Neck"
- Neck.Part0 = Torso
- Neck.Part1 = Head
- Neck.C0 = CFrame.new(0, 1.5, 0)
- Neck.C1 = CFrame.new()
- Neck.Parent = Torso
- script.HDecap:Clone().Parent = Head
- if ahd then
- Head:BreakJoints()
- if bod then
- blood = game.Lighting.Blood:Clone()
- blood.CFrame = CFrame.new(Vector3.new(Head.Position.X+math.random(-5,5),Head.Position.Y+math.random(-5,5),Head.Position.Z+math.random(-5,5)))
- blood.Parent = game.Workspace
- blood = game.Lighting.Blood:Clone()
- blood.CFrame = CFrame.new(Vector3.new(Head.Position.X+math.random(-5,5),Head.Position.Y+math.random(-5,5),Head.Position.Z+math.random(-5,5)))
- blood.Parent = game.Workspace
- blood = game.Lighting.Blood:Clone()
- blood.CFrame = CFrame.new(Vector3.new(Head.Position.X+math.random(-5,5),Head.Position.Y+math.random(-5,5),Head.Position.Z+math.random(-5,5)))
- blood.Parent = game.Workspace
- end
- if gore then
- brain = game.Lighting["Brain Gib"]:Clone()
- brain.CFrame = CFrame.new(Vector3.new(Head.Position.X+math.random(-5,5),Head.Position.Y+math.random(-5,5),Head.Position.Z+math.random(-5,5)))
- brain.Parent = game.Workspace
- flesh = game.Lighting["Flesh Gib"]:Clone()
- flesh.CFrame = CFrame.new(Vector3.new(Head.Position.X+math.random(-5,5),Head.Position.Y+math.random(-5,5),Head.Position.Z+math.random(-5,5)))
- flesh.Parent = game.Workspace
- flesh = game.Lighting["Flesh Gib"]:Clone()
- flesh.CFrame = CFrame.new(Vector3.new(Head.Position.X+math.random(-5,5),Head.Position.Y+math.random(-5,5),Head.Position.Z+math.random(-5,5)))
- flesh.Parent = game.Workspace
- end
- end
- end
- local Limb = Character:FindFirstChild("Right Arm")
- if Limb then
- Limb.Parent = game.Workspace
- script.Decap:Clone().Parent = Limb
- Limb.CFrame = Torso.CFrame * CFrame.new(1.5, 0, 0)
- local Joint = Instance.new("Glue")
- Joint.Name = "RightShoulder"
- Joint.Part0 = Torso
- Joint.Part1 = Limb
- Joint.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- Joint.C1 = CFrame.new(-0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- Joint.Parent = Torso
- local B = Instance.new("Part")
- B.TopSurface = 0
- B.BottomSurface = 0
- B.formFactor = "Symmetric"
- B.Size = Vector3.new(1, 1, 1)
- B.Transparency = 1
- B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
- B.Parent = Character
- local W = Instance.new("Weld")
- W.Part0 = Limb
- W.Part1 = B
- W.C0 = CFrame.new(0, -0.5, 0)
- W.Parent = Limb
- end
- local Limb = Character:FindFirstChild("Left Arm")
- if Limb then
- Limb.Parent = game.Workspace
- script.Decap:Clone().Parent = Limb
- Limb.CFrame = Torso.CFrame * CFrame.new(-1.5, 0, 0)
- local Joint = Instance.new("Glue")
- Joint.Name = "LeftShoulder"
- Joint.Part0 = Torso
- Joint.Part1 = Limb
- Joint.C0 = CFrame.new(-1.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- Joint.C1 = CFrame.new(0, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- Joint.Parent = Torso
- local B = Instance.new("Part")
- B.TopSurface = 0
- B.BottomSurface = 0
- B.formFactor = "Symmetric"
- B.Size = Vector3.new(1, 1, 1)
- B.Transparency = 1
- B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
- B.Parent = Character
- local W = Instance.new("Weld")
- W.Part0 = Limb
- W.Part1 = B
- W.C0 = CFrame.new(0, -0.5, 0)
- W.Parent = Limb
- end
- local Limb = Character:FindFirstChild("Right Leg")
- if Limb then
- Limb.Parent = game.Workspace
- script.Decap:Clone().Parent = Limb
- Limb.CFrame = Torso.CFrame * CFrame.new(0.5, -2, 0)
- local Joint = Instance.new("Glue")
- Joint.Name = "RightHip"
- Joint.Part0 = Torso
- Joint.Part1 = Limb
- Joint.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- Joint.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- Joint.Parent = Torso
- local B = Instance.new("Part")
- B.TopSurface = 0
- B.BottomSurface = 0
- B.formFactor = "Symmetric"
- B.Size = Vector3.new(1, 1, 1)
- B.Transparency = 1
- B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
- B.Parent = Character
- local W = Instance.new("Weld")
- W.Part0 = Limb
- W.Part1 = B
- W.C0 = CFrame.new(0, -0.5, 0)
- W.Parent = Limb
- end
- local Limb = Character:FindFirstChild("Left Leg")
- if Limb then
- Limb.Parent = game.Workspace
- script.Decap:Clone().Parent = Limb
- Limb.CFrame = Torso.CFrame * CFrame.new(-0.5, -2, 0)
- local Joint = Instance.new("Glue")
- Joint.Name = "LeftHip"
- Joint.Part0 = Torso
- Joint.Part1 = Limb
- Joint.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- Joint.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- Joint.Parent = Torso
- local B = Instance.new("Part")
- B.TopSurface = 0
- B.BottomSurface = 0
- B.formFactor = "Symmetric"
- B.Size = Vector3.new(1, 1, 1)
- B.Transparency = 1
- B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
- B.Parent = Character
- local W = Instance.new("Weld")
- W.Part0 = Limb
- W.Part1 = B
- W.C0 = CFrame.new(0, -0.5, 0)
- W.Parent = Limb
- end
- --[
- local Bar = Instance.new("Part")
- Bar.TopSurface = 0
- Bar.BottomSurface = 0
- Bar.formFactor = "Symmetric"
- Bar.Size = Vector3.new(1, 1, 1)
- Bar.Transparency = 1
- Bar.CFrame = Torso.CFrame * CFrame.new(0, 0.5, 0)
- Bar.Parent = game.Workspace
- local Weld = Instance.new("Weld")
- Weld.Part0 = Torso
- Weld.Part1 = Bar
- Weld.C0 = CFrame.new(0, 0.5, 0)
- Weld.Parent = Torso
- --]]
- end
- end
- Humanoid.Died:connect(OnDeath)
- end;
- function() function OnTouched(hit)
- if script.Parent.Velocity.Magnitude >= 80 or hit.Velocity.Magnitude >= 80 then
- script.Parent:BreakJoints()
- flesh = game.Lighting["Flesh Gib"]:Clone()
- flesh.CFrame = CFrame.new(Vector3.new(script.Parent.Position.X+math.random(-5,5),script.Parent.Position.Y+math.random(-5,5),script.Parent.Position.Z+math.random(-5,5)))
- flesh.Parent = game.Workspace
- flesh = game.Lighting["Flesh Gib"]:Clone()
- flesh.CFrame = CFrame.new(Vector3.new(script.Parent.Position.X+math.random(-5,5),script.Parent.Position.Y+math.random(-5,5),script.Parent.Position.Z+math.random(-5,5)))
- flesh.Parent = game.Workspace
- script.Parent.BrickColor = BrickColor.new('Persimmon')
- b = script.Blood:Clone()
- f = script.fall:Clone()
- g = script.Gorey:Clone()
- b.Parent = script.Parent
- f.Parent = script.Parent
- g.Parent = script.Parent
- b.blood.Disabled = false
- script:Remove()
- end
- end
- script.Parent.Touched:connect(OnTouched) end;
- function() script.Parent.Enabled = true
- wait(5)
- script.Parent.Enabled = false
- wait(1)
- script.Parent.Enabled = true
- wait(3)
- script.Parent.Enabled = false
- script.Disabled = true end;
- function() function OnTouched(hit)
- if script.Parent.Velocity.Magnitude >= 5 then
- blood = game.Lighting.Blood:Clone()
- blood.CFrame = CFrame.new(Vector3.new(script.Parent.Position.X+math.random(-5,5),.1,script.Parent.Position.Z+math.random(-5,5)))
- blood.Parent = game.Workspace
- end
- if script.Parent.Velocity.Magnitude >= 20 then
- script.Parent.Blood.blood.Disabled = false
- script.Parent.fall.Pitch = math.random(5,15)/10
- script.Parent.fall:Play()
- end
- end
- script.Parent.Touched:connect(OnTouched) end;
- function() function OnTouched(hit)
- if script.Parent.Velocity.Magnitude >= 80 or hit.Velocity.Magnitude >= 80 then
- script.Parent:BreakJoints()
- brain = game.Lighting["Brain Gib"]:Clone()
- brain.CFrame = CFrame.new(Vector3.new(script.Parent.Position.X+math.random(-5,5),script.Parent.Position.Y+math.random(-5,5),script.Parent.Position.Z+math.random(-5,5)))
- brain.Parent = game.Workspace
- flesh = game.Lighting["Flesh Gib"]:Clone()
- flesh.CFrame = CFrame.new(Vector3.new(script.Parent.Position.X+math.random(-5,5),script.Parent.Position.Y+math.random(-5,5),script.Parent.Position.Z+math.random(-5,5)))
- flesh.Parent = game.Workspace
- flesh = game.Lighting["Flesh Gib"]:Clone()
- flesh.CFrame = CFrame.new(Vector3.new(script.Parent.Position.X+math.random(-5,5),script.Parent.Position.Y+math.random(-5,5),script.Parent.Position.Z+math.random(-5,5)))
- flesh.Parent = game.Workspace
- b = script.Blood:Clone()
- f = script.fall:Clone()
- g = script.Gorey:Clone()
- b.Parent = script.Parent
- f.Parent = script.Parent
- g.Parent = script.Parent
- b.blood.Disabled = false
- script.Parent.BrickColor = BrickColor.new('Persimmon')
- script:Remove()
- end
- end
- script.Parent.Touched:connect(OnTouched) end;
- function() script.Parent.Enabled = true
- wait(5)
- script.Parent.Enabled = false
- wait(1)
- script.Parent.Enabled = true
- wait(3)
- script.Parent.Enabled = false
- script.Disabled = true end;
- function() function OnTouched(hit)
- if script.Parent.Velocity.Magnitude >= 5 then
- blood = game.Lighting.Blood:Clone()
- blood.CFrame = CFrame.new(Vector3.new(script.Parent.Position.X+math.random(-5,5),.1,script.Parent.Position.Z+math.random(-5,5)))
- blood.Parent = game.Workspace
- end
- if script.Parent.Velocity.Magnitude >= 20 then
- script.Parent.Blood.blood.Disabled = false
- script.Parent.fall.Pitch = math.random(5,15)/10
- script.Parent.fall:Play()
- end
- end
- script.Parent.Touched:connect(OnTouched) end;
- function() local CurrentPart = nil
- local MaxInc = 16
- function onTouched(hit)
- if hit.Parent == nil then
- return
- end
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if humanoid == nil then
- CurrentPart = hit
- end
- end
- function waitForChild(parent, childName)
- local child = parent:findFirstChild(childName)
- if child then
- return child
- end
- while true do
- print(childName)
- child = parent.ChildAdded:wait()
- if child.Name==childName then
- return child
- end
- end
- end
- local Figure = script.Parent
- local Humanoid = waitForChild(Figure, "Humanoid")
- local Torso = waitForChild(Figure, "Torso")
- local Left = waitForChild(Figure, "Left Leg")
- local Right = waitForChild(Figure, "Right Leg")
- Humanoid.Jump = true
- Left.Touched:connect(onTouched)
- Right.Touched:connect(onTouched)
- while true do
- wait(math.random(2, 10))
- if CurrentPart ~= nil then
- if math.random(1, 2) == 1 then
- Humanoid.Jump = true
- end
- Humanoid:MoveTo(Torso.Position + Vector3.new(math.random(-MaxInc, MaxInc), 0, math.random(-MaxInc, MaxInc)), CurrentPart)
- end
- end end;
- function() ---This server script creates the sounds and also exists so that it can be easily copied into an NPC and create sounds for that NPC.
- --Remove the local script if you copy this into an NPC.
- 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
- function newSound(name, id)
- local sound = Instance.new("Sound")
- sound.SoundId = id
- sound.Name = name
- sound.archivable = false
- sound.Parent = script.Parent.Head
- return sound
- end
- -- declarations
- local sGettingUp = newSound("GettingUp", "rbxasset://sounds/action_get_up.mp3")
- local sDied = newSound("Died", "rbxasset://sounds/uuhhh.mp3")
- local sFreeFalling = newSound("FreeFalling", "rbxasset://sounds/action_falling.mp3")
- local sJumping = newSound("Jumping", "rbxasset://sounds/action_jump.mp3")
- local sLanding = newSound("Landing", "rbxasset://sounds/action_jump_land.mp3")
- local sSplash = newSound("Splash", "rbxasset://sounds/impact_water.mp3")
- local sRunning = newSound("Running", "rbxasset://sounds/action_footsteps_plastic.mp3")
- sRunning.Looped = true
- local sSwimming = newSound("Swimming", "rbxasset://sounds/action_swim.mp3")
- sSwimming.Looped = true
- local sClimbing = newSound("Climbing", "rbxasset://sounds/action_footsteps_plastic.mp3")
- sClimbing.Looped = true
- local Figure = script.Parent
- local Head = waitForChild(Figure, "Head")
- local Humanoid;
- for _,Child in pairs(Figure:GetChildren())do
- if Child and Child.ClassName=="Humanoid"then
- Humanoid=Child;
- end;
- end;
- local hasPlayer = game.Players:GetPlayerFromCharacter(script.Parent)
- local filteringEnabled = game.Workspace.FilteringEnabled
- local prevState = "None"
- -- functions
- function onDied()
- stopLoopedSounds()
- for _,Child in pairs(Figure:FindFirstChild("Head"):GetChildren())do
- if Child and Child.ClassName=="Sound"then
- Child.Volume=0
- Child:Stop()
- end
- end
- sDied.Volume=1;
- sDied:Play();
- end
- local fallCount = 0
- local fallSpeed = 0
- function onStateFall(state, sound)
- fallCount = fallCount + 1
- if state then
- sound.Volume = 0
- sound:Play()
- Spawn( function()
- local t = 0
- local thisFall = fallCount
- while t < 1.5 and fallCount == thisFall do
- local vol = math.max(t - 0.3 , 0)
- sound.Volume = vol
- wait(0.1)
- t = t + 0.1
- end
- end)
- else
- sound:Stop()
- end
- fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y))
- end
- function onStateNoStop(state, sound)
- if state then
- sound:Play()
- end
- end
- function onRunning(speed)
- sClimbing:Stop()
- sSwimming:Stop()
- if (prevState == "FreeFall" and fallSpeed > 0.1) then
- local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
- sLanding.Volume = vol
- sLanding:Play()
- fallSpeed = 0
- end
- if speed>0.5 then
- sRunning:Play()
- sRunning.Pitch = speed / 8.0
- else
- sRunning:Stop()
- end
- prevState = "Run"
- end
- function onSwimming(speed)
- if (prevState ~= "Swim" and speed > 0.1) then
- local volume = math.min(1.0, speed / 350)
- sSplash.Volume = volume
- sSplash:Play()
- prevState = "Swim"
- end
- sClimbing:Stop()
- sRunning:Stop()
- sSwimming.Pitch = 1.6
- sSwimming:Play()
- end
- function onClimbing(speed)
- sRunning:Stop()
- sSwimming:Stop()
- if speed>0.01 then
- sClimbing:Play()
- sClimbing.Pitch = speed / 5.5
- else
- sClimbing:Stop()
- end
- prevState = "Climb"
- end
- -- connect up
- function stopLoopedSounds()
- sRunning:Stop()
- sClimbing:Stop()
- sSwimming:Stop()
- end
- if hasPlayer == nil then
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Swimming:connect(onSwimming)
- Humanoid.Climbing:connect(onClimbing)
- Humanoid.Jumping:connect(function(state) onStateNoStop(state, sJumping) prevState = "Jump" end)
- Humanoid.GettingUp:connect(function(state) stopLoopedSounds() onStateNoStop(state, sGettingUp) prevState = "GetUp" end)
- Humanoid.FreeFalling:connect(function(state) stopLoopedSounds() onStateFall(state, sFreeFalling) prevState = "FreeFall" end)
- Humanoid.FallingDown:connect(function(state) stopLoopedSounds() end)
- Humanoid.StateChanged:connect(function(old, new)
- if not (new.Name == "Dead" or
- new.Name == "Running" or
- new.Name == "RunningNoPhysics" or
- new.Name == "Swimming" or
- new.Name == "Jumping" or
- new.Name == "GettingUp" or
- new.Name == "Freefall" or
- new.Name == "FallingDown") then
- stopLoopedSounds()
- end
- end)
- end
- end;
- function() --This local script will run only for the player whos character it is in. It's changes to the sounds will replicate as they are changes to the character.
- -- util
- 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
- -- declarations
- local Figure = script.Parent.Parent
- local Head = waitForChild(Figure, "Head")
- local Humanoid = waitForChild(Figure, "Humanoid")
- local sGettingUp = waitForChild(Head, "GettingUp")
- local sDied = waitForChild(Head, "Died")
- local sFreeFalling = waitForChild(Head, "FreeFalling")
- local sJumping = waitForChild(Head, "Jumping")
- local sLanding = waitForChild(Head, "Landing")
- local sSplash = waitForChild(Head, "Splash")
- local sRunning = waitForChild(Head, "Running")
- sRunning.Looped = true
- local sSwimming = waitForChild(Head, "Swimming")
- sSwimming.Looped = true
- local sClimbing =waitForChild(Head, "Climbing")
- sClimbing.Looped = true
- local prevState = "None"
- -- functions
- function onDied()
- stopLoopedSounds()
- sDied:Play()
- end
- local fallCount = 0
- local fallSpeed = 0
- function onStateFall(state, sound)
- fallCount = fallCount + 1
- if state then
- sound.Volume = 0
- sound:Play()
- Spawn( function()
- local t = 0
- local thisFall = fallCount
- while t < 1.5 and fallCount == thisFall do
- local vol = math.max(t - 0.3 , 0)
- sound.Volume = vol
- wait(0.1)
- t = t + 0.1
- end
- end)
- else
- sound:Stop()
- end
- fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y))
- end
- function onStateNoStop(state, sound)
- if state then
- sound:Play()
- end
- end
- function onRunning(speed)
- sClimbing:Stop()
- sSwimming:Stop()
- if (prevState == "FreeFall" and fallSpeed > 0.1) then
- local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
- sLanding.Volume = vol
- sLanding:Play()
- fallSpeed = 0
- end
- if speed>0.5 then
- sRunning:Play()
- sRunning.Pitch = speed / 8.0
- else
- sRunning:Stop()
- end
- prevState = "Run"
- end
- function onSwimming(speed)
- if (prevState ~= "Swim" and speed > 0.1) then
- local volume = math.min(1.0, speed / 350)
- sSplash.Volume = volume
- sSplash:Play()
- prevState = "Swim"
- end
- sClimbing:Stop()
- sRunning:Stop()
- sSwimming.Pitch = 1.6
- sSwimming:Play()
- end
- function onClimbing(speed)
- sRunning:Stop()
- sSwimming:Stop()
- if speed>0.01 then
- sClimbing:Play()
- sClimbing.Pitch = speed / 5.5
- else
- sClimbing:Stop()
- end
- prevState = "Climb"
- end
- -- connect up
- function stopLoopedSounds()
- sRunning:Stop()
- sClimbing:Stop()
- sSwimming:Stop()
- end
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Swimming:connect(onSwimming)
- Humanoid.Climbing:connect(onClimbing)
- Humanoid.Jumping:connect(function(state) onStateNoStop(state, sJumping) prevState = "Jump" end)
- Humanoid.GettingUp:connect(function(state) stopLoopedSounds() onStateNoStop(state, sGettingUp) prevState = "GetUp" end)
- Humanoid.FreeFalling:connect(function(state) stopLoopedSounds() onStateFall(state, sFreeFalling) prevState = "FreeFall" end)
- Humanoid.FallingDown:connect(function(state) stopLoopedSounds() end)
- Humanoid.StateChanged:connect(function(old, new)
- if not (new.Name == "Dead" or
- new.Name == "Running" or
- new.Name == "RunningNoPhysics" or
- new.Name == "Swimming" or
- new.Name == "Jumping" or
- new.Name == "GettingUp" or
- new.Name == "Freefall" or
- new.Name == "FallingDown") then
- stopLoopedSounds()
- end
- end)
- end;}local ActualScripts = {}
- function s(var)
- local func = table.remove(Scripts,1)
- setfenv(func,setmetatable({script=var,require=fake_require or require,global=genv},{
- __index = getfenv(func),
- }))
- table.insert(ActualScripts,coroutine.wrap(func))
- end
- Decode = function(str,t,props,classes,values,ICList,Model,CurPar,LastIns,split,RemoveAndSplit,InstanceList)
- local tonum,table_remove,inst,parnt,comma,table_foreach = tonumber,table.remove,Instance.new,"Parent",",",
- function(t,f)
- for a,b in pairs(t) do
- f(a,b)
- end
- end
- local Types = {
- Color3 = Color3.new,
- Vector3 = Vector3.new,
- Vector2 = Vector2.new,
- UDim = UDim.new,
- UDim2 = UDim2.new,
- CFrame = CFrame.new,
- Rect = Rect.new,
- NumberRange = NumberRange.new,
- BrickColor = BrickColor.new,
- PhysicalProperties = PhysicalProperties.new,
- NumberSequence = function(...)
- local a = {...}
- local t = {}
- repeat
- t[#t+1] = NumberSequenceKeypoint.new(table_remove(a,1),table_remove(a,1),table_remove(a,1))
- until #a==0
- return NumberSequence.new(t)
- end,
- ColorSequence = function(...)
- local a = {...}
- local t = {}
- repeat
- t[#t+1] = ColorSequenceKeypoint.new(table_remove(a,1),Color3.new(table_remove(a,1),table_remove(a,1),table_remove(a,1)))
- until #a==0
- return ColorSequence.new(t)
- end,
- number = tonumber,
- boolean = function(a)
- return a=="1"
- end
- }
- split = function(str,sep)
- if not str then return end
- local fields = {}
- local ConcatNext = false
- str:gsub(("([^%s]+)"):format(sep),function(c)
- if ConcatNext == true then
- fields[#fields] = fields[#fields]..sep..c
- ConcatNext = false
- else
- fields[#fields+1] = c
- end
- if c:sub(#c)=="\\" then
- c = fields[#fields]
- fields[#fields] = c:sub(1,#c-1)
- ConcatNext = true
- end
- end)
- return fields
- end
- RemoveAndSplit = function(t)
- return split(table_remove(t,1),comma)
- end
- t = split(str,";")
- props = RemoveAndSplit(t)
- classes = RemoveAndSplit(t)
- values = split(table_remove(t,1),'|')
- ICList = RemoveAndSplit(t)
- InstanceList = {}
- Model = inst"Model"
- CurPar = Model
- table_foreach(t,function(ct,c)
- if c=="n" or c=="p" then
- CurPar = c=="n" and LastIns or CurPar[parnt]
- else
- ct = split(c,"|")
- local class = classes[tonum(table_remove(ct,1))]
- if class=="UnionOperation" then
- LastIns = {UsePartColor="1"}
- else
- LastIns = inst(class)
- if LastIns:IsA"Script" then
- s(LastIns)
- elseif LastIns:IsA("ModuleScript") then
- ms(LastIns)
- end
- end
- local function SetProperty(LastIns,p,str,s)
- s = Types[typeof(LastIns[p])]
- if p=="CustomPhysicalProperties" then
- s = PhysicalProperties.new
- end
- if s then
- LastIns[p] = s(unpack(split(str,comma)))
- else
- LastIns[p] = str
- end
- end
- local UnionData
- table_foreach(ct,function(s,p,a,str)
- a = p:find":"
- p,str = props[tonum(p:sub(1,a-1))],values[tonum(p:sub(a+1))]
- if p=="UnionData" then
- UnionData = split(str," ")
- return
- end
- if class=="UnionOperation" then
- LastIns[p] = str
- return
- end
- SetProperty(LastIns,p,str)
- end)
- if UnionData then
- local LI_Data = LastIns
- LastIns = DecodeUnion(UnionData)
- table_foreach(LI_Data,function(p,str)
- SetProperty(LastIns,p,str)
- end)
- end
- table.insert(InstanceList,LastIns)
- LastIns[parnt] = CurPar
- end
- end)
- table_remove(ICList,1)
- table_foreach(ICList,function(a,b)
- b = split(b,">")
- InstanceList[tonum(b[1])][props[tonum(b[2])]] = InstanceList[tonum(b[3])]
- end)
- return Model:GetChildren()
- end
- local Objects = Decode('Name,HeadColor3,LeftArmColor3,RightArmColor3,LeftLegColor3,RightLegColor3,TorsoColor3,AnimationId,Value,MeshId,BodyPart,NameOcclusion,Health,MaxHealth,JumpPower,Color,Transparency,Position,Orientation'
- ..',Size,TopSurface,CFrame,Scale,MeshType,Anchored,Material,BottomSurface,Texture,MaxVelocity,C0,C1,Part0,Part1,CanCollide,Velocity,LeftSurface,RightSurface,Enabled,Speed,Acceleration,Lifetime,EmitterSiz'
- ..'e,SoundId,Volume,PantsTemplate,ShirtTemplate;Part,Model,BodyColors,Script,StringValue,Animation,NumberValue,CharacterMesh,Humanoid,LocalScript,Attachment,SpecialMesh,Decal,Motor6D,MeshPart,Folder,Bool'
- ..'Value,ParticleEmitter,Sound,Pants,Shirt;Part|NPC|0.898,0.8941,0.8745|0.4549,0.5254,0.6156|Animate|climb|ClimbAnim|http://www.roblox.com/asset/?id=180436334|fall|FallAnim|http://www.roblox.com/asset/?i'
- ..'d=180436148|idle|Animation1|http://www.roblox.com/asset/?id=180435571|Weight|9|Animation2|http://www.roblox.com/asset/?id=180435792|1|jump|JumpAnim|http://www.roblox.com/asset/?id=125750702|run|RunAni'
- ..'m|http://www.roblox.com/asset/?id=180426354|sit|SitAnim|http://www.roblox.com/asset/?id=178130996|toolnone|ToolNoneAnim|http://www.roblox.com/asset/?id=182393478|walk|WalkAnim|BloodS|3.0 Male Right Ar'
- ..'m|82908019|3|1|1000|0|Status|AvalibleSpawns|Respawn|3.0 Male Left Arm|82907977|2|3.0 Male Right Leg|81487710|5|Head|-23.7335,7.803,54.5893|0,90,0|3.468,1.734,1.734|0|HairAttachment|0,1.0404,0|0,1.0404'
- ..',0,1,0,0,0,1,0,0,0,1|HatAttachment|FaceFrontAttachment|0,0,-1.0405|0,0,-1.0405,1,0,0,0,1,0,0,0,1|FaceCenterAttachment|2.1675,2.1675,2.1675|http://www.roblox.com/asset/?id=83001675|Ball|0.0509,0.4117,0'
- ..'.6745|272|-24.3067,7.0602,53.8004|0.8175,0.7815,0.887|-23.5875,7.2208,55.548|1.6038,1.5199,1.7117|-23.5875,7.5397,53.9094|0.7695,1.4408,0.8846|-23.5875,7.2232,53.4959|-23.5419,7.4582,54.5903|1.6949,2.'
- ..'2007,1.0836|-23.5875,7.5397,55.1489|-24.3067,7.0602,55.3275|BloxMan|0.9372,0.7215,0.2196|-23.9705,8.2927,54.5696|-13.9,90,0|2.0225,1.0112,1.0112|1.264,1.264,1.264|http://roblox.com/asset/?id=83001675|'
- ..'http://www.roblox.com/asset/?id=102312301|qPerfectionWeld|HumanoidRootPart|-23.7335,5.202,54.5893|3.468,3.468,1.734|RootJoint|0.1|0,0,0,-1,0,0,0,0,1,0,1,-0|Left Arm|-23.7335,5.202,57.1903|1.734,3.468,'
- ..'1.734|LeftShoulderAttachment|0,0.867,0|0,0.867,0,1,0,0,0,1,0,0,0,1|LeftArm|LeftHand|-24.2951,3.3811,57.5148|0,90,28.6|1.0311,1.6387,1.1069|-24.1367,5.1729,57.4395|20.6499,84.41,-15.95|0.9358,0.9675,0.'
- ..'7278|-24.0997,4.0795,57.8457|-0.0001,-0.0001,-0.0001|0.9358,0.9675,0.9675|LeftLowerArm|-23.6393,4.8733,57.5879|1.291,1.7125,1.2868|LeftUpperArm|-23.5934,6.1268,56.9409|0,90.1699,-28.3|1.5223,2.2981,1.'
- ..'5487|-23.657,5.8553,57.1776|-31.3,0,0|1.6733,2.0233,1.1531|-23.5875,6.9727,56.8582|2.2726,1.7261,1.7884|Left Leg|-23.7335,1.734,55.4563|LeftFoot|0.6431,0.7411,0.2784|-23.7934,0.3705,55.3776|0,90.1699,'
- ..'0|0.9437,0.7411,1.734|LeftLowerLeg|-23.635,1.2015,55.4025|0.9741,2.125,1.1876|LeftUpperLeg|-23.6504,2.6936,55.4251|1.1991,2.5506,1.3511|-23.2866,1.8232,55.3552|0.6922,1.7009,1.0617|-23.9027,1.8232,55.'
- ..'3552|-24.1329,3.0818,55.4394|0.7982,1.9612,1.2242|-23.5671,3.1776,55.419|1.4575,1.6783,1.0755|Right Arm|-23.7335,5.202,51.9883|RightShoulderAttachment|RightArm|RightHand|-24.0278,5.2356,51.8409|20.649'
- ..'9,84.41,12.25|-23.9678,3.989,51.4478|0,-0.0001,-0.0001|-24.1249,3.3907,51.7017|0,90,-18.8|RightLowerArm|-23.5543,4.7993,51.7324|RightUpperArm|-23.6046,6.1719,52.2737|0,90.1699,13.3|-23.651,5.8688,52.0'
- ..'416|14.6999,0,0|1.6613,2.0233,1.1962|-23.5875,6.9727,52.4063|Right Leg|-23.7335,1.734,53.7223|Legs|RightFoot|-23.7978,0.3705,53.8926|RightLowerLeg|-23.6395,1.2015,53.8667|RightUpperLeg|-23.6551,2.6936'
- ..',53.8443|-24.1329,3.0818,53.7732|-23.9027,1.8232,53.9101|-23.4904,3.1248,53.8299|1.4575,1.7838,1.169|-23.2866,1.8232,53.9101|Torso|roblox|NeckAttachment|0,1.734,0|0,1.734,0,1,0,0,0,1,0,0,0,1|BodyBackA'
- ..'ttachment|0,0,0.867|0,0,0.867,1,0,0,0,1,0,0,0,1|LeftCollarAttachment|-1.7341,1.734,0|-1.7341,1.734,0,1,0,0,0,1,0,0,0,1|RightCollarAttachment|1.734,1.734,0|1.734,1.734,0,1,0,0,0,1,0,0,0,1|WaistFrontAtt'
- ..'achment|0,-1.7341,-0.8671|0,-1.7341,-0.8671,1,0,0,0,1,0,0,0,1|WaistCenterAttachment|0,-1.7341,0|0,-1.7341,0,1,0,0,0,1,0,0,0,1|WaistBackAttachment|0,-1.7341,0.867|0,-1.7341,0.867,1,0,0,0,1,0,0,0,1|Body'
- ..'FrontAttachment|0,0,-0.8671|0,0,-0.8671,1,0,0,0,1,0,0,0,1|Right Shoulder|1.734,0.867,0,0,0,1,0,1,-0,-1,0,0|-0.8671,0.867,0,0,0,1,0,1,-0,-1,0,0|Left Shoulder|-1.7341,0.867,0,0,0,-1,0,1,0,1,0,0|0.867,0.'
- ..'867,0,0,0,-1,0,1,0,1,0,0|Right Hip|1.734,-1.7341,0,0,0,1,0,1,-0,-1,0,0|0.867,1.734,0,0,0,1,0,1,-0,-1,0,0|Left Hip|-1.7341,-1.7341,0,0,0,-1,0,1,0,1,0,0|-0.8671,1.734,0,0,0,-1,0,1,0,1,0,0|Neck|0,1.734,0'
- ..',-1,0,0,0,0,1,0,1,-0|0,-0.8671,0,-1,0,0,0,0,1,0,1,-0|LowerTorso|-23.7595,4.2125,54.635|2.8026,1.1978,1.8205|UpperTorso|-23.763,5.5976,54.635|3.6154,3.2592,2.135|Pillow|-24.5951,5.3517,55.0589|0,-90,90'
- ..'|0.6809,1.0214,0.3404|0.3404,0.5107,0.3404|http://www.roblox.com/asset/?id=19106014|-24.5768,5.3517,54.2535|0,-90,-90|-24.6225,4.9537,54.9859|0.5737,0.8605,0.2868|0.2868,0.4302,0.2868|-24.607,4.9537,5'
- ..'4.3074|-24.5884,6.2643,55.3515|1.2146,1.8219,0.6073|0.863,0.9109,0.6072|-24.6205,4.6157,54.8798|0.4307,0.646,0.2153|0.2153,0.323,0.2153|-24.6089,4.6157,54.3703|-24.5884,6.2643,53.9107|-24.375,4.2896,5'
- ..'4.6227|0.7383,1.0764,1.5343|-23.868,3.5252,54.6754|1.1195,1.0764,1.1507|Blood And Gore|Config|Auto_Head_Decap|Gore|Blood_On_Death|Decap|Blood|0,1,0,0,1,0.2784,0,0|0,0.5,0,1,0.5,0|10,10|0,-10,2|2,2|blo'
- ..'od|Gorey|rbxassetid://178646271|0.3|HDecap|3.0 Male Left Leg|81487640|4|Move|Pants|http://www.roblox.com/asset/?id=144076759|Shirt|http://www.roblox.com/asset/?id=144076357|Sound|LocalSound|3.0 Male T'
- ..'orso|82907945;0,77>32>76,77>33>132,142>32>132,142>33>105,143>32>132,143>33>78,144>32>132,144>33>118,145>32>132,145>33>91,146>32>132,146>33>51;2|1:2;n;3|2:3|3:3|4:3|5:4|6:4|7:3;4|1:5;n;5|1:6;n;6|1:7|8:'
- ..'8;p;5|1:9;n;6|1:10|8:11;p;5|1:12;n;6|1:13|8:14;n;7|1:15|9:16;p;6|1:17|8:18;n;7|1:15|9:19;p;p;5|1:20;n;6|1:21|8:22;p;5|1:23;n;6|1:24|8:25;p;5|1:26;n;6|1:27|8:28;p;5|1:29;n;6|1:30|8:31;p;5|1:32;n;6|1:33'
- ..'|8:25;p;p;4|1:34;8|1:35|10:36|11:37;9|12:38|13:39|14:39|15:40;n;2|1:41;n;2|1:42;p;p;4|1:43;8|1:44|10:45|11:46;10|1:5;n;5|1:12;n;6|1:13|8:14;n;7|1:15|9:16;p;6|1:17|8:18;n;7|1:15|9:19;p;p;5|1:32;n;6|1:3'
- ..'3|8:25;p;5|1:23;n;6|1:24|8:25;p;5|1:20;n;6|1:21|8:22;p;5|1:6;n;6|1:7|8:8;p;5|1:29;n;6|1:30|8:31;p;5|1:9;n;6|1:10|8:11;p;5|1:26;n;6|1:27|8:28;p;p;8|1:47|10:48|11:49;1|1:50|16:3|17:19|18:51|19:52|20:53|'
- ..'21:54|16:3|16:3;n;11|1:55|18:56|22:57;11|1:58|18:56|22:57;11|1:59|18:60|22:61;11|1:62;12|23:63|10:64|24:49;2|1:50;n;1|1:65|25:19|16:66|26:67|18:68|20:69|27:54|21:54|16:66|16:66;n;12|24:37;p;1|1:65|25:'
- ..'19|16:66|26:67|18:70|20:71|27:54|21:54|16:66|16:66;n;12|24:37;p;1|1:65|25:19|16:66|26:67|18:72|20:73|27:54|21:54|16:66|16:66;n;12|24:37;p;1|1:65|25:19|16:66|26:67|18:74|20:71|27:54|21:54|16:66|16:66;n'
- ..';12|24:37;p;1|1:65|25:19|16:66|26:67|18:75|20:76|27:54|21:54|16:66|16:66;n;12|24:37;p;1|1:65|25:19|16:66|26:67|18:77|20:73|27:54|21:54|16:66|16:66;n;12|24:37;p;1|1:65|25:19|16:66|26:67|18:78|20:69|27:'
- ..'54|21:54|16:66|16:66;n;12|24:37;p;1|1:79|25:19|16:80|18:81|19:82|20:83|21:54|16:80|16:80;n;12|23:84|10:85|24:49;13|28:86;p;p;4|1:87;p;1|1:88|17:19|18:89|19:52|20:90|27:54|21:54;n;14|1:91|29:92|30:93|3'
- ..'1:93;p;1|1:94|16:3|17:19|18:95|19:52|20:96|34:40|16:3|16:3;n;11|1:97|18:98|22:99;2|1:100;n;15|1:101|25:19|16:80|18:102|19:103|20:104|34:40|16:80|16:80;15|1:101|25:19|16:80|18:105|19:106|20:107|34:40|1'
- ..'6:80|16:80;15|1:101|25:19|16:80|18:108|19:106|35:109|20:110|34:40|16:80|16:80;15|1:111|25:19|16:80|18:112|19:106|35:109|20:113|34:40|16:80|16:80;15|1:114|25:19|16:80|18:115|19:116|35:109|20:117|34:40|'
- ..'16:80|16:80;1|1:65|25:19|16:80|26:67|18:118|19:119|20:120|27:54|21:54|16:80|16:80;n;12|24:37;p;1|1:65|25:19|16:80|26:67|18:121|20:122|27:54|21:54|16:80|16:80;n;12|24:37;p;p;4|1:87;p;1|1:123|16:4|17:19'
- ..'|18:124|19:52|20:96|34:40|27:54|16:4|16:4;n;2;n;15|1:125|25:19|16:126|18:127|19:128|35:109|20:129|34:40|16:126|16:126;15|1:130|25:19|16:126|18:131|19:128|35:109|20:132|34:40|16:126|16:126;15|1:133|25:'
- ..'19|16:126|18:134|19:128|35:109|20:135|34:40|16:126|16:126;1|1:65|25:19|16:126|26:67|18:136|20:137|27:54|21:54|16:126|16:126;n;12|24:37;p;1|1:65|25:19|16:126|26:67|18:138|20:137|27:54|21:54|16:126|16:1'
- ..'26;n;12|24:37;p;1|1:65|25:19|16:126|26:67|18:139|20:140|27:54|21:54|16:126|16:126;n;12|24:37;p;1|1:65|25:19|16:126|26:67|18:141|20:142|27:54|21:54|16:126|16:126;n;12|24:37;p;p;4|1:87;p;1|1:143|16:3|17'
- ..':19|18:144|19:52|20:96|34:40|16:3|16:3;n;11|1:145|18:98|22:99;2|1:146;n;15|1:147|25:19|16:80|18:148|19:149|20:110|34:40|16:80|16:80;15|1:147|25:19|16:80|18:150|19:149|35:151|20:110|34:40|16:80|16:80;1'
- ..'5|1:147|25:19|16:80|18:152|19:153|20:104|34:40|16:80|16:80;15|1:154|25:19|16:80|18:155|19:149|35:151|20:113|34:40|16:80|16:80;15|1:156|25:19|16:80|18:157|19:158|35:151|20:117|34:40|16:80|16:80;1|1:65|'
- ..'25:19|16:80|26:67|18:159|19:160|20:161|27:54|21:54|16:80|16:80;n;12|24:37;p;1|1:65|25:19|16:80|26:67|18:162|20:122|27:54|21:54|16:80|16:80;n;12|24:37;p;p;4|1:87;p;1|1:163|16:4|17:19|18:164|19:52|20:96'
- ..'|34:40|27:54|16:4|16:4;n;2|1:165;n;15|1:166|25:19|16:126|18:167|19:128|35:109|20:129|34:40|16:126|16:126;15|1:168|25:19|16:126|18:169|19:128|35:109|20:132|34:40|16:126|16:126;15|1:170|25:19|16:126|18:'
- ..'171|19:128|20:135|34:40|16:126|16:126;1|1:65|25:19|16:126|26:67|18:172|20:140|27:54|21:54|16:126|16:126;n;12|24:37;p;1|1:65|25:19|16:126|26:67|18:173|20:137|27:54|21:54|16:126|16:126;n;12|24:37;p;1|1:'
- ..'65|25:19|16:126|26:67|18:174|20:175|27:54|21:54|16:126|16:126;n;12|24:37;p;1|1:65|25:19|16:126|26:67|18:176|20:137|27:54|21:54|16:126|16:126;n;12|24:37;p;p;4|1:87;p;1|1:177|16:3|17:19|18:89|19:52|20:9'
- ..'0|36:46|37:46|16:3|16:3;n;13|1:178;11|1:179|18:180|22:181;11|1:182|18:183|22:184;11|1:185|18:186|22:187;11|1:188|18:189|22:190;11|1:191|18:192|22:193;11|1:194|18:195|22:196;11|1:197|18:198|22:199;11|1'
- ..':200|18:201|22:202;14|1:203|29:92|30:204|31:205;14|1:206|29:92|30:207|31:208;14|1:209|29:92|30:210|31:211;14|1:212|29:92|30:213|31:214;14|1:215|29:92|30:216|31:217;2|1:177;n;15|1:218|25:19|16:66|18:21'
- ..'9|19:128|35:109|20:220|16:66|16:66;15|1:221|25:19|16:66|18:222|19:128|35:109|20:223|16:66|16:66;1|1:224|25:19|16:66|18:225|19:226|20:227|27:54|21:54|16:66|16:66;n;12|23:228|10:229|24:49;p;1|1:224|25:1'
- ..'9|16:66|18:230|19:231|20:227|27:54|21:54|16:66|16:66;n;12|23:228|10:229|24:49;p;1|1:224|25:19|16:66|18:232|19:226|20:233|27:54|21:54|16:66|16:66;n;12|23:234|10:229|24:49;p;1|1:224|25:19|16:66|18:235|1'
- ..'9:231|20:233|27:54|21:54|16:66|16:66;n;12|23:234|10:229|24:49;p;1|1:224|25:19|16:66|18:236|19:226|20:237|27:54|21:54|16:66|16:66;n;12|23:238|10:229|24:49;p;1|1:224|25:19|16:66|18:239|19:226|20:240|27:'
- ..'54|21:54|16:66|16:66;n;12|23:241|10:229|24:49;p;1|1:224|25:19|16:66|18:242|19:231|20:240|27:54|21:54|16:66|16:66;n;12|23:241|10:229|24:49;p;1|1:224|25:19|16:66|18:243|19:231|20:237|27:54|21:54|16:66|1'
- ..'6:66;n;12|23:238|10:229|24:49;p;1|1:65|25:19|16:66|26:67|18:244|20:245|27:54|21:54|16:66|16:66;n;12|24:37;p;p;1|1:65|25:19|16:126|26:67|18:246|20:247|27:54|21:54|16:126|16:126;n;12|24:37;p;4|1:87;p;4|'
- ..'1:248;n;16|1:249;n;17|1:250;17|1:251|9:19;17|1:252|9:19;p;4|1:253;n;18|1:254|16:255|20:256|38:40|16:255|39:257|40:258|16:255|41:259;n;4|1:260;p;4|1:261;19|1:9|42:40|43:262|44:263;p;4|1:264;n;18|1:254|'
- ..'16:255|20:256|38:40|16:255|39:257|40:258|16:255|41:259;n;4|1:260;p;4|1:261;19|1:9|42:40|43:262|44:263;p;p;8|1:265|10:266|11:267;4|1:268;20|1:269|45:270;21|1:271|46:272;4|1:273;n;10|1:274;p;8|1:275|10:'
- ..'276|11:38;p;')
- for _,Object in pairs(Objects) do
- Object.Parent = script and script.Parent==workspace and script or workspace
- end
- for _,f in pairs(ActualScripts) do f() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement