Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Model0 = Instance.new("Model")
- Script1 = Instance.new("Script")
- Sound2 = Instance.new("Sound")
- MeshPart3 = Instance.new("MeshPart")
- Vector3Value4 = Instance.new("Vector3Value")
- Script5 = Instance.new("Script")
- Script6 = Instance.new("Script")
- Script7 = Instance.new("Script")
- Motor6D8 = Instance.new("Motor6D")
- MeshPart9 = Instance.new("MeshPart")
- Vector3Value10 = Instance.new("Vector3Value")
- Script11 = Instance.new("Script")
- Script12 = Instance.new("Script")
- Motor6D13 = Instance.new("Motor6D")
- MeshPart14 = Instance.new("MeshPart")
- Vector3Value15 = Instance.new("Vector3Value")
- Motor6D16 = Instance.new("Motor6D")
- MeshPart17 = Instance.new("MeshPart")
- Vector3Value18 = Instance.new("Vector3Value")
- Motor6D19 = Instance.new("Motor6D")
- MeshPart20 = Instance.new("MeshPart")
- Vector3Value21 = Instance.new("Vector3Value")
- Motor6D22 = Instance.new("Motor6D")
- MeshPart23 = Instance.new("MeshPart")
- Vector3Value24 = Instance.new("Vector3Value")
- Script25 = Instance.new("Script")
- Script26 = Instance.new("Script")
- Motor6D27 = Instance.new("Motor6D")
- Script28 = Instance.new("Script")
- MeshPart29 = Instance.new("MeshPart")
- Vector3Value30 = Instance.new("Vector3Value")
- Script31 = Instance.new("Script")
- Script32 = Instance.new("Script")
- Script33 = Instance.new("Script")
- Motor6D34 = Instance.new("Motor6D")
- MeshPart35 = Instance.new("MeshPart")
- Vector3Value36 = Instance.new("Vector3Value")
- Script37 = Instance.new("Script")
- Script38 = Instance.new("Script")
- Script39 = Instance.new("Script")
- Motor6D40 = Instance.new("Motor6D")
- MeshPart41 = Instance.new("MeshPart")
- Vector3Value42 = Instance.new("Vector3Value")
- Script43 = Instance.new("Script")
- Script44 = Instance.new("Script")
- Motor6D45 = Instance.new("Motor6D")
- MeshPart46 = Instance.new("MeshPart")
- Vector3Value47 = Instance.new("Vector3Value")
- Motor6D48 = Instance.new("Motor6D")
- MeshPart49 = Instance.new("MeshPart")
- Vector3Value50 = Instance.new("Vector3Value")
- Motor6D51 = Instance.new("Motor6D")
- MeshPart52 = Instance.new("MeshPart")
- Vector3Value53 = Instance.new("Vector3Value")
- Motor6D54 = Instance.new("Motor6D")
- IntValue55 = Instance.new("IntValue")
- Humanoid56 = Instance.new("Humanoid")
- MeshPart57 = Instance.new("MeshPart")
- Vector3Value58 = Instance.new("Vector3Value")
- Script59 = Instance.new("Script")
- Script60 = Instance.new("Script")
- Script61 = Instance.new("Script")
- Motor6D62 = Instance.new("Motor6D")
- Script63 = Instance.new("Script")
- Part64 = Instance.new("Part")
- Vector3Value65 = Instance.new("Vector3Value")
- Script66 = Instance.new("Script")
- Script67 = Instance.new("Script")
- Part68 = Instance.new("Part")
- Script69 = Instance.new("Script")
- ScreenGui70 = Instance.new("ScreenGui")
- Frame71 = Instance.new("Frame")
- ImageLabel72 = Instance.new("ImageLabel")
- Sound73 = Instance.new("Sound")
- Script74 = Instance.new("Script")
- Part75 = Instance.new("Part")
- Vector3Value76 = Instance.new("Vector3Value")
- Script77 = Instance.new("Script")
- Script78 = Instance.new("Script")
- SpecialMesh79 = Instance.new("SpecialMesh")
- Motor6D80 = Instance.new("Motor6D")
- Script81 = Instance.new("Script")
- Script82 = Instance.new("Script")
- Script83 = Instance.new("Script")
- StringValue84 = Instance.new("StringValue")
- Animation85 = Instance.new("Animation")
- StringValue86 = Instance.new("StringValue")
- Animation87 = Instance.new("Animation")
- StringValue88 = Instance.new("StringValue")
- Animation89 = Instance.new("Animation")
- NumberValue90 = Instance.new("NumberValue")
- Animation91 = Instance.new("Animation")
- NumberValue92 = Instance.new("NumberValue")
- Animation93 = Instance.new("Animation")
- NumberValue94 = Instance.new("NumberValue")
- StringValue95 = Instance.new("StringValue")
- Animation96 = Instance.new("Animation")
- NumberValue97 = Instance.new("NumberValue")
- Animation98 = Instance.new("Animation")
- NumberValue99 = Instance.new("NumberValue")
- Animation100 = Instance.new("Animation")
- NumberValue101 = Instance.new("NumberValue")
- StringValue102 = Instance.new("StringValue")
- Animation103 = Instance.new("Animation")
- NumberValue104 = Instance.new("NumberValue")
- Animation105 = Instance.new("Animation")
- NumberValue106 = Instance.new("NumberValue")
- Animation107 = Instance.new("Animation")
- NumberValue108 = Instance.new("NumberValue")
- StringValue109 = Instance.new("StringValue")
- Animation110 = Instance.new("Animation")
- StringValue111 = Instance.new("StringValue")
- Animation112 = Instance.new("Animation")
- NumberValue113 = Instance.new("NumberValue")
- Animation114 = Instance.new("Animation")
- NumberValue115 = Instance.new("NumberValue")
- StringValue116 = Instance.new("StringValue")
- Animation117 = Instance.new("Animation")
- StringValue118 = Instance.new("StringValue")
- Animation119 = Instance.new("Animation")
- StringValue120 = Instance.new("StringValue")
- Animation121 = Instance.new("Animation")
- StringValue122 = Instance.new("StringValue")
- Animation123 = Instance.new("Animation")
- StringValue124 = Instance.new("StringValue")
- Animation125 = Instance.new("Animation")
- StringValue126 = Instance.new("StringValue")
- Animation127 = Instance.new("Animation")
- StringValue128 = Instance.new("StringValue")
- Animation129 = Instance.new("Animation")
- StringValue130 = Instance.new("StringValue")
- Animation131 = Instance.new("Animation")
- StringValue132 = Instance.new("StringValue")
- Animation133 = Instance.new("Animation")
- StringValue134 = Instance.new("StringValue")
- Animation135 = Instance.new("Animation")
- StringValue136 = Instance.new("StringValue")
- Animation137 = Instance.new("Animation")
- StringValue138 = Instance.new("StringValue")
- Animation139 = Instance.new("Animation")
- Script140 = Instance.new("Script")
- Script141 = Instance.new("Script")
- Script142 = Instance.new("Script")
- LocalScript143 = Instance.new("LocalScript")
- Script144 = Instance.new("Script")
- ObjectValue145 = Instance.new("ObjectValue")
- MeshPart146 = Instance.new("MeshPart")
- Vector3Value147 = Instance.new("Vector3Value")
- Script148 = Instance.new("Script")
- Script149 = Instance.new("Script")
- Script150 = Instance.new("Script")
- Motor6D151 = Instance.new("Motor6D")
- Model0.Name = " "
- Model0.Parent = mas
- Script1.Name = "MusicScript"
- Script1.Parent = Model0
- table.insert(cors,sandbox(Script1,function()
- --Made by Stickmasterluke
- gw=game.Workspace
- function message(text,time)
- local oldmsg=gw:FindFirstChild("Hint")
- if oldmsg then
- oldmsg.Parent=nil
- end
- local spacenumber=time*0
- local msg=Instance.new("Hint")
- msg.Parent=gw
- --[[for i=1, spacenumber do
- wait(1/25)
- local maketext=""
- for i2=1, i do
- maketext=maketext.." "
- end
- maketext=maketext..text
- for i2=1, spacenumber-i do
- maketext=maketext.." "
- end
- msg.Text=maketext
- end]]
- msg.Text=text
- wait(0)
- msg.Parent=nil
- end
- last=""
- lastlast=""
- while true do
- wait(0)
- local tracks=script:GetChildren()
- local rn=math.random(1,#tracks)
- local track=tracks[rn]
- if track~=nil then
- if track.className=="Sound" and track.Name~=last and track.Name~=lastlast then
- lastlast=last
- last=track.Name
- message(track.Name,50)
- track:play()
- wait(10000000000000000000000000)
- track:pause()
- end
- end
- end
- end))
- Sound2.Name = "Shrek Anthem"
- Sound2.Parent = Script1
- Sound2.Looped = true
- Sound2.SoundId = "rbxassetid://869166432"
- Sound2.Volume = 10
- MeshPart3.Name = "LeftHand"
- MeshPart3.Parent = Model0
- MeshPart3.CFrame = CFrame.new(-44.8896103, 14.6752701, 32.3903465, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
- MeshPart3.Orientation = Vector3.new(0, -89.9599991, 0)
- MeshPart3.Position = Vector3.new(-44.8896103, 14.6752701, 32.3903465)
- MeshPart3.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
- MeshPart3.Color = Color3.new(0.960784, 0.803922, 0.188235)
- MeshPart3.Size = Vector3.new(6.76771307, 2.27050734, 6.77447462)
- MeshPart3.BrickColor = BrickColor.new("Bright yellow")
- MeshPart3.CanCollide = false
- MeshPart3.brickColor = BrickColor.new("Bright yellow")
- Vector3Value4.Name = "OriginalSize"
- Vector3Value4.Parent = MeshPart3
- Vector3Value4.Value = Vector3.new(0.999299049, 0.335255831, 1.00029743)
- Script5.Name = "ShieldScript"
- Script5.Parent = MeshPart3
- table.insert(cors,sandbox(Script5,function()
- function ot(hit)
- ch = hit:GetChildren()
- for i = 1, #ch do
- if ch[i].className == "BodyVelocity" then
- ch[i].velocity = ch[i].velocity*-1
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- if hit.Parent:FindFirstChild("Torso") ~= nil then
- hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- end
- hit.Parent.Humanoid.PlatformStand = true
- end
- else
- if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
- if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- else
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- wait(0.5)
- hit.Parent.Humanoid.PlatformStand = false
- end
- end
- end
- end
- function remove(child)
- child:Remove()
- end
- script.Parent.Touched:connect(ot)
- script.Parent.ChildAdded:connect(remove)
- end))
- Script6.Name = "Hurting"
- Script6.Parent = MeshPart3
- table.insert(cors,sandbox(Script6,function()
- function onTouched(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if (humanoid ~= nil) then
- humanoid.Health = humanoid.Health - 25
- end
- end
- script.Parent.Touched:connect(onTouched)
- end))
- Script7.Name = "qPerfectionWeld"
- Script7.Parent = MeshPart3
- table.insert(cors,sandbox(Script7,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))
- Motor6D8.Name = "LeftWrist"
- Motor6D8.Parent = MeshPart3
- Motor6D8.C0 = CFrame.new(-0.0112809651, -4.6205492, -0.0670197308, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D8.C1 = CFrame.new(-0.0026157822, 0.39213115, -0.104560249, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D8.Part0 = MeshPart9
- Motor6D8.Part1 = MeshPart3
- Motor6D8.part1 = MeshPart3
- MeshPart9.Name = "LeftLowerArm"
- MeshPart9.Parent = Model0
- MeshPart9.CFrame = CFrame.new(-44.8519096, 19.6879501, 32.3990784, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
- MeshPart9.Orientation = Vector3.new(0, -89.9599991, 0)
- MeshPart9.Position = Vector3.new(-44.8519096, 19.6879501, 32.3990784)
- MeshPart9.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
- MeshPart9.Color = Color3.new(0.960784, 0.803922, 0.188235)
- MeshPart9.Size = Vector3.new(6.77433443, 8.5717144, 6.77415848)
- MeshPart9.BrickColor = BrickColor.new("Bright yellow")
- MeshPart9.CanCollide = false
- MeshPart9.brickColor = BrickColor.new("Bright yellow")
- Vector3Value10.Name = "OriginalSize"
- Vector3Value10.Parent = MeshPart9
- Vector3Value10.Value = Vector3.new(1.00027657, 1.26567209, 1.00025082)
- Script11.Name = "Hurting"
- Script11.Parent = MeshPart9
- table.insert(cors,sandbox(Script11,function()
- function onTouched(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if (humanoid ~= nil) then
- humanoid.Health = humanoid.Health - 25
- end
- end
- script.Parent.Touched:connect(onTouched)
- end))
- Script12.Name = "ShieldScript"
- Script12.Parent = MeshPart9
- table.insert(cors,sandbox(Script12,function()
- function ot(hit)
- ch = hit:GetChildren()
- for i = 1, #ch do
- if ch[i].className == "BodyVelocity" then
- ch[i].velocity = ch[i].velocity*-1
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- if hit.Parent:FindFirstChild("Torso") ~= nil then
- hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- end
- hit.Parent.Humanoid.PlatformStand = true
- end
- else
- if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
- if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- else
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- wait(0.5)
- hit.Parent.Humanoid.PlatformStand = false
- end
- end
- end
- end
- function remove(child)
- child:Remove()
- end
- script.Parent.Touched:connect(ot)
- script.Parent.ChildAdded:connect(remove)
- end))
- Motor6D13.Name = "LeftElbow"
- Motor6D13.Parent = MeshPart9
- Motor6D13.C0 = CFrame.new(-0.0112769287, -1.78210199, -0.0639314502, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D13.C1 = CFrame.new(-0.0112809651, 0.832677782, -0.0670197308, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D13.Part0 = MeshPart17
- Motor6D13.Part1 = MeshPart9
- Motor6D13.part1 = MeshPart9
- MeshPart14.Name = "LeftLowerLeg"
- MeshPart14.Parent = Model0
- MeshPart14.CFrame = CFrame.new(-44.8823509, 6.16508913, 39.1501884, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
- MeshPart14.Orientation = Vector3.new(0, -89.9599991, 0)
- MeshPart14.Position = Vector3.new(-44.8823509, 6.16508913, 39.1501884)
- MeshPart14.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
- MeshPart14.Color = Color3.new(0.294118, 0.592157, 0.294118)
- MeshPart14.Size = Vector3.new(6.77432919, 10.088563, 6.77468634)
- MeshPart14.BrickColor = BrickColor.new("Bright green")
- MeshPart14.CanCollide = false
- MeshPart14.brickColor = BrickColor.new("Bright green")
- Vector3Value15.Name = "OriginalSize"
- Vector3Value15.Parent = MeshPart14
- Vector3Value15.Value = Vector3.new(1.00027585, 1.48964536, 1.00032866)
- Motor6D16.Name = "LeftKnee"
- Motor6D16.Parent = MeshPart14
- Motor6D16.C0 = CFrame.new(-0.0259127952, -1.79122257, 0.00397367822, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D16.C1 = CFrame.new(-0.0259127952, 1.9631238, 0.00206926349, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D16.Part0 = MeshPart20
- Motor6D16.Part1 = MeshPart14
- Motor6D16.part1 = MeshPart14
- MeshPart17.Name = "LeftUpperArm"
- MeshPart17.Parent = Model0
- MeshPart17.CFrame = CFrame.new(-44.8487396, 22.3027306, 32.3991203, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
- MeshPart17.Orientation = Vector3.new(0, -89.9599991, 0)
- MeshPart17.Position = Vector3.new(-44.8487396, 22.3027306, 32.3991203)
- MeshPart17.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
- MeshPart17.Color = Color3.new(1, 1, 0)
- MeshPart17.Size = Vector3.new(6.77433252, 9.45123863, 6.77415848)
- MeshPart17.BrickColor = BrickColor.new("New Yeller")
- MeshPart17.CanCollide = false
- MeshPart17.brickColor = BrickColor.new("New Yeller")
- Vector3Value18.Name = "OriginalSize"
- Vector3Value18.Parent = MeshPart17
- Vector3Value18.Value = Vector3.new(1.00027633, 1.39554, 1.00025082)
- Motor6D19.Name = "LeftShoulder"
- Motor6D19.Parent = MeshPart17
- Motor6D19.C0 = CFrame.new(-8.46254921, 3.768255, -0.105385743, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D19.C1 = CFrame.new(1.67933309, 3.09320617, -0.0639314502, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D19.Part0 = MeshPart57
- Motor6D19.Part1 = MeshPart17
- Motor6D19.part1 = MeshPart17
- MeshPart20.Name = "LeftUpperLeg"
- MeshPart20.Parent = Model0
- MeshPart20.CFrame = CFrame.new(-44.8803291, 9.9194355, 39.1502571, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
- MeshPart20.Orientation = Vector3.new(0, -89.9599991, 0)
- MeshPart20.Position = Vector3.new(-44.8803291, 9.9194355, 39.1502571)
- MeshPart20.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
- MeshPart20.Color = Color3.new(0, 1, 0)
- MeshPart20.Size = Vector3.new(6.7743268, 10.4042921, 6.77875233)
- MeshPart20.BrickColor = BrickColor.new("Lime green")
- MeshPart20.CanCollide = false
- MeshPart20.brickColor = BrickColor.new("Lime green")
- Vector3Value21.Name = "OriginalSize"
- Vector3Value21.Parent = MeshPart20
- Vector3Value21.Value = Vector3.new(1.00027561, 1.5362649, 1.00092912)
- Motor6D22.Name = "LeftHip"
- Motor6D22.Parent = MeshPart20
- Motor6D22.C0 = CFrame.new(-3.41684103, -1.64612925, 0.00831584446, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D22.C1 = CFrame.new(-0.0259127952, 3.28541422, 0.00465092249, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D22.Part0 = MeshPart23
- Motor6D22.Part1 = MeshPart20
- Motor6D22.part1 = MeshPart20
- MeshPart23.Name = "LowerTorso"
- MeshPart23.Parent = Model0
- MeshPart23.CFrame = CFrame.new(-44.873909, 14.850914, 42.541275, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
- MeshPart23.Orientation = Vector3.new(0, -89.9599991, 0)
- MeshPart23.Position = Vector3.new(-44.873909, 14.850914, 42.541275)
- MeshPart23.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
- MeshPart23.Color = Color3.new(0.0509804, 0.411765, 0.67451)
- MeshPart23.Size = Vector3.new(13.546114, 2.70923901, 6.77390051)
- MeshPart23.BrickColor = BrickColor.new("Bright blue")
- MeshPart23.brickColor = BrickColor.new("Bright blue")
- Vector3Value24.Name = "OriginalSize"
- Vector3Value24.Parent = MeshPart23
- Vector3Value24.Value = Vector3.new(2.00017595, 0.400037616, 1.00021255)
- Script25.Name = "Hurting"
- Script25.Parent = MeshPart23
- table.insert(cors,sandbox(Script25,function()
- function onTouched(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if (humanoid ~= nil) then
- humanoid.Health = humanoid.Health - 25
- end
- end
- script.Parent.Touched:connect(onTouched)
- end))
- Script26.Name = "ShieldScript"
- Script26.Parent = MeshPart23
- table.insert(cors,sandbox(Script26,function()
- function ot(hit)
- ch = hit:GetChildren()
- for i = 1, #ch do
- if ch[i].className == "BodyVelocity" then
- ch[i].velocity = ch[i].velocity*-1
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- if hit.Parent:FindFirstChild("Torso") ~= nil then
- hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- end
- hit.Parent.Humanoid.PlatformStand = true
- end
- else
- if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
- if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- else
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- wait(0.5)
- hit.Parent.Humanoid.PlatformStand = false
- end
- end
- end
- end
- function remove(child)
- child:Remove()
- end
- script.Parent.Touched:connect(ot)
- script.Parent.ChildAdded:connect(remove)
- end))
- Motor6D27.Name = "Root"
- Motor6D27.Parent = MeshPart23
- Motor6D27.C1 = CFrame.new(0.00189745135, 0.900993049, -0.0966572911, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D27.Part0 = Part64
- Motor6D27.Part1 = MeshPart23
- Motor6D27.part1 = MeshPart23
- Script28.Name = "Respawn"
- Script28.Parent = Model0
- table.insert(cors,sandbox(Script28,function()
- name="NPC"
- robo=script.Parent:clone()
- while true do
- wait(15)
- if script.Parent.NPC.Health<1 then
- robot=robo:clone()
- robot.Parent=script.Parent.Parent
- robot:makeJoints()
- script.Parent:remove()
- end
- end
- end))
- MeshPart29.Name = "RightFoot"
- MeshPart29.Parent = Model0
- MeshPart29.CFrame = CFrame.new(-44.8781891, 1.13590193, 45.900589, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
- MeshPart29.Orientation = Vector3.new(0, -89.9599991, 0)
- MeshPart29.Position = Vector3.new(-44.8781891, 1.13590193, 45.900589)
- MeshPart29.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
- MeshPart29.Color = Color3.new(0.294118, 0.592157, 0.294118)
- MeshPart29.Size = Vector3.new(6.77673674, 2.27153325, 6.77383852)
- MeshPart29.BrickColor = BrickColor.new("Bright green")
- MeshPart29.CanCollide = false
- MeshPart29.brickColor = BrickColor.new("Bright green")
- Vector3Value30.Name = "OriginalSize"
- Vector3Value30.Parent = MeshPart29
- Vector3Value30.Value = Vector3.new(1.00063133, 0.335407376, 1.00020337)
- Script31.Name = "ShieldScript"
- Script31.Parent = MeshPart29
- table.insert(cors,sandbox(Script31,function()
- function ot(hit)
- ch = hit:GetChildren()
- for i = 1, #ch do
- if ch[i].className == "BodyVelocity" then
- ch[i].velocity = ch[i].velocity*-1
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- if hit.Parent:FindFirstChild("Torso") ~= nil then
- hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- end
- hit.Parent.Humanoid.PlatformStand = true
- end
- else
- if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
- if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- else
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- wait(0.5)
- hit.Parent.Humanoid.PlatformStand = false
- end
- end
- end
- end
- function remove(child)
- child:Remove()
- end
- script.Parent.Touched:connect(ot)
- script.Parent.ChildAdded:connect(remove)
- end))
- Script32.Name = "Hurting"
- Script32.Parent = MeshPart29
- table.insert(cors,sandbox(Script32,function()
- function onTouched(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if (humanoid ~= nil) then
- humanoid.Health = humanoid.Health - 25
- end
- end
- script.Parent.Touched:connect(onTouched)
- end))
- Script33.Name = "qPerfectionWeld"
- Script33.Parent = MeshPart29
- table.insert(cors,sandbox(Script33,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))
- Motor6D34.Name = "RightAnkle"
- Motor6D34.Parent = MeshPart29
- Motor6D34.C0 = CFrame.new(0.0259127952, -4.8134017, 0.00191943871, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D34.C1 = CFrame.new(0.0610660091, 0.215656728, 0.0010534653, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D34.Part0 = MeshPart46
- Motor6D34.Part1 = MeshPart29
- Motor6D34.part1 = MeshPart29
- MeshPart35.Name = "RightHand"
- MeshPart35.Parent = Model0
- MeshPart35.CFrame = CFrame.new(-44.8740196, 14.6748857, 52.6960068, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
- MeshPart35.Orientation = Vector3.new(0, -89.9599991, 0)
- MeshPart35.Position = Vector3.new(-44.8740196, 14.6748857, 52.6960068)
- MeshPart35.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
- MeshPart35.Color = Color3.new(0.960784, 0.803922, 0.188235)
- MeshPart35.Size = Vector3.new(6.76771307, 2.27050614, 6.77447462)
- MeshPart35.BrickColor = BrickColor.new("Bright yellow")
- MeshPart35.CanCollide = false
- MeshPart35.brickColor = BrickColor.new("Bright yellow")
- Vector3Value36.Name = "OriginalSize"
- Vector3Value36.Parent = MeshPart35
- Vector3Value36.Value = Vector3.new(0.999299049, 0.335255772, 1.00029743)
- Script37.Name = "ShieldScript"
- Script37.Parent = MeshPart35
- table.insert(cors,sandbox(Script37,function()
- function ot(hit)
- ch = hit:GetChildren()
- for i = 1, #ch do
- if ch[i].className == "BodyVelocity" then
- ch[i].velocity = ch[i].velocity*-1
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- if hit.Parent:FindFirstChild("Torso") ~= nil then
- hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- end
- hit.Parent.Humanoid.PlatformStand = true
- end
- else
- if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
- if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- else
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- wait(0.5)
- hit.Parent.Humanoid.PlatformStand = false
- end
- end
- end
- end
- function remove(child)
- child:Remove()
- end
- script.Parent.Touched:connect(ot)
- script.Parent.ChildAdded:connect(remove)
- end))
- Script38.Name = "Hurting"
- Script38.Parent = MeshPart35
- table.insert(cors,sandbox(Script38,function()
- function onTouched(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if (humanoid ~= nil) then
- humanoid.Health = humanoid.Health - 25
- end
- end
- script.Parent.Touched:connect(onTouched)
- end))
- Script39.Name = "qPerfectionWeld"
- Script39.Parent = MeshPart35
- table.insert(cors,sandbox(Script39,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))
- Motor6D40.Name = "RightWrist"
- Motor6D40.Parent = MeshPart35
- Motor6D40.C0 = CFrame.new(0.014524051, -4.61915302, -0.067019932, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D40.C1 = CFrame.new(0.00585886789, 0.393527001, -0.104560249, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D40.Part0 = MeshPart41
- Motor6D40.Part1 = MeshPart35
- Motor6D40.part1 = MeshPart35
- MeshPart41.Name = "RightLowerArm"
- MeshPart41.Parent = Model0
- MeshPart41.CFrame = CFrame.new(-44.8363304, 19.6875648, 52.6874084, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
- MeshPart41.Orientation = Vector3.new(0, -89.9599991, 0)
- MeshPart41.Position = Vector3.new(-44.8363304, 19.6875648, 52.6874084)
- MeshPart41.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
- MeshPart41.Color = Color3.new(0.960784, 0.803922, 0.188235)
- MeshPart41.Size = Vector3.new(6.77433443, 8.5717144, 6.77415848)
- MeshPart41.BrickColor = BrickColor.new("Bright yellow")
- MeshPart41.CanCollide = false
- MeshPart41.brickColor = BrickColor.new("Bright yellow")
- Vector3Value42.Name = "OriginalSize"
- Vector3Value42.Parent = MeshPart41
- Vector3Value42.Value = Vector3.new(1.00027657, 1.26567209, 1.00025082)
- Script43.Name = "Hurting"
- Script43.Parent = MeshPart41
- table.insert(cors,sandbox(Script43,function()
- function onTouched(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if (humanoid ~= nil) then
- humanoid.Health = humanoid.Health - 25
- end
- end
- script.Parent.Touched:connect(onTouched)
- end))
- Script44.Name = "ShieldScript"
- Script44.Parent = MeshPart41
- table.insert(cors,sandbox(Script44,function()
- function ot(hit)
- ch = hit:GetChildren()
- for i = 1, #ch do
- if ch[i].className == "BodyVelocity" then
- ch[i].velocity = ch[i].velocity*-1
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- if hit.Parent:FindFirstChild("Torso") ~= nil then
- hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- end
- hit.Parent.Humanoid.PlatformStand = true
- end
- else
- if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
- if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- else
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- wait(0.5)
- hit.Parent.Humanoid.PlatformStand = false
- end
- end
- end
- end
- function remove(child)
- child:Remove()
- end
- script.Parent.Touched:connect(ot)
- script.Parent.ChildAdded:connect(remove)
- end))
- Motor6D45.Name = "RightElbow"
- Motor6D45.Parent = MeshPart41
- Motor6D45.C0 = CFrame.new(0.0145200128, -1.78210199, -0.0639328733, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D45.C1 = CFrame.new(0.014524051, 0.832677782, -0.067019932, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D45.Part0 = MeshPart49
- Motor6D45.Part1 = MeshPart41
- Motor6D45.part1 = MeshPart41
- MeshPart46.Name = "RightLowerLeg"
- MeshPart46.Parent = Model0
- MeshPart46.CFrame = CFrame.new(-44.87714, 6.16495991, 45.9358368, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
- MeshPart46.Orientation = Vector3.new(0, -89.9599991, 0)
- MeshPart46.Position = Vector3.new(-44.87714, 6.16495991, 45.9358368)
- MeshPart46.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
- MeshPart46.Color = Color3.new(0.294118, 0.592157, 0.294118)
- MeshPart46.Size = Vector3.new(6.77432919, 10.088563, 6.77468538)
- MeshPart46.BrickColor = BrickColor.new("Bright green")
- MeshPart46.CanCollide = false
- MeshPart46.brickColor = BrickColor.new("Bright green")
- Vector3Value47.Name = "OriginalSize"
- Vector3Value47.Parent = MeshPart46
- Vector3Value47.Value = Vector3.new(1.00027585, 1.48964536, 1.00032854)
- Motor6D48.Name = "RightKnee"
- Motor6D48.Parent = MeshPart46
- Motor6D48.C0 = CFrame.new(0.0259127952, -1.7952857, 0.00289178547, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D48.C1 = CFrame.new(0.0259127952, 1.95906019, 0.000987774343, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D48.Part0 = MeshPart52
- Motor6D48.Part1 = MeshPart46
- Motor6D48.part1 = MeshPart46
- MeshPart49.Name = "RightUpperArm"
- MeshPart49.Parent = Model0
- MeshPart49.CFrame = CFrame.new(-44.8331604, 22.3023453, 52.687458, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
- MeshPart49.Orientation = Vector3.new(0, -89.9599991, 0)
- MeshPart49.Position = Vector3.new(-44.8331604, 22.3023453, 52.687458)
- MeshPart49.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
- MeshPart49.Color = Color3.new(1, 1, 0)
- MeshPart49.Size = Vector3.new(6.77433252, 9.45123863, 6.77415848)
- MeshPart49.BrickColor = BrickColor.new("New Yeller")
- MeshPart49.CanCollide = false
- MeshPart49.brickColor = BrickColor.new("New Yeller")
- Vector3Value50.Name = "OriginalSize"
- Vector3Value50.Parent = MeshPart49
- Vector3Value50.Value = Vector3.new(1.00027633, 1.39554, 1.00025082)
- Motor6D51.Name = "RightShoulder"
- Motor6D51.Parent = MeshPart49
- Motor6D51.C0 = CFrame.new(8.46773338, 3.76923919, -0.105385743, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D51.C1 = CFrame.new(-1.67872834, 3.09419036, -0.0639328733, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D51.Part0 = MeshPart57
- Motor6D51.Part1 = MeshPart49
- Motor6D51.part1 = MeshPart49
- MeshPart52.Name = "RightUpperLeg"
- MeshPart52.Parent = Model0
- MeshPart52.CFrame = CFrame.new(-44.8751183, 9.9193058, 45.9359055, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
- MeshPart52.Orientation = Vector3.new(0, -89.9599991, 0)
- MeshPart52.Position = Vector3.new(-44.8751183, 9.9193058, 45.9359055)
- MeshPart52.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
- MeshPart52.Color = Color3.new(0, 1, 0)
- MeshPart52.Size = Vector3.new(6.7743268, 10.4042921, 6.77875233)
- MeshPart52.BrickColor = BrickColor.new("Lime green")
- MeshPart52.CanCollide = false
- MeshPart52.brickColor = BrickColor.new("Lime green")
- Vector3Value53.Name = "OriginalSize"
- Vector3Value53.Parent = MeshPart52
- Vector3Value53.Value = Vector3.new(1.00027561, 1.5362649, 1.00092912)
- Motor6D54.Name = "RightHip"
- Motor6D54.Parent = MeshPart52
- Motor6D54.C0 = CFrame.new(3.42063618, -1.64748406, 0.00696135359, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D54.C1 = CFrame.new(0.0259127952, 3.28405929, 0.00329693779, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D54.Part0 = MeshPart23
- Motor6D54.Part1 = MeshPart52
- Motor6D54.part1 = MeshPart52
- IntValue55.Name = "Mode"
- IntValue55.Parent = Model0
- Humanoid56.Name = "NPC"
- Humanoid56.Parent = Model0
- Humanoid56.Health = 15000
- Humanoid56.HealthDisplayDistance = 0
- Humanoid56.HipHeight = 7.5
- Humanoid56.JumpPower = 100
- Humanoid56.MaxHealth = 15000
- Humanoid56.MaxSlopeAngle = 89.900001525879
- Humanoid56.NameDisplayDistance = 0
- Humanoid56.NameOcclusion = Enum.NameOcclusion.EnemyOcclusion
- Humanoid56.RigType = Enum.HumanoidRigType.R15
- Humanoid56.Torso = Part64
- Humanoid56.WalkSpeed = 40
- Humanoid56.maxHealth = 15000
- MeshPart57.Name = "UpperTorso"
- MeshPart57.Parent = Model0
- MeshPart57.CFrame = CFrame.new(-44.8824272, 21.627491, 42.5410194, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
- MeshPart57.Orientation = Vector3.new(0, -89.9599991, 0)
- MeshPart57.Position = Vector3.new(-44.8824272, 21.627491, 42.5410194)
- MeshPart57.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
- MeshPart57.Color = Color3.new(0, 0, 1)
- MeshPart57.Size = Vector3.new(13.5468998, 10.8422594, 6.77609539)
- MeshPart57.BrickColor = BrickColor.new("Really blue")
- MeshPart57.brickColor = BrickColor.new("Really blue")
- Vector3Value58.Name = "OriginalSize"
- Vector3Value58.Parent = MeshPart57
- Vector3Value58.Value = Vector3.new(2.00029206, 1.60093355, 1.0005368)
- Script59.Name = "Damage Script"
- Script59.Parent = MeshPart57
- table.insert(cors,sandbox(Script59,function()
- function onTouched(hit)
- local human = hit.Parent:findFirstChild("Humanoid")
- if (human ~= nil) then
- human.Health = human.Health - 5 -- Change the amount to change the damage.
- end
- end
- script.Parent.Touched:connect(onTouched)
- end))
- Script60.Name = "Hurting"
- Script60.Parent = MeshPart57
- table.insert(cors,sandbox(Script60,function()
- function onTouched(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if (humanoid ~= nil) then
- humanoid.Health = humanoid.Health - 25
- end
- end
- script.Parent.Touched:connect(onTouched)
- end))
- Script61.Name = "ShieldScript"
- Script61.Parent = MeshPart57
- table.insert(cors,sandbox(Script61,function()
- function ot(hit)
- ch = hit:GetChildren()
- for i = 1, #ch do
- if ch[i].className == "BodyVelocity" then
- ch[i].velocity = ch[i].velocity*-1
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- if hit.Parent:FindFirstChild("Torso") ~= nil then
- hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- end
- hit.Parent.Humanoid.PlatformStand = true
- end
- else
- if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
- if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- else
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- wait(0.5)
- hit.Parent.Humanoid.PlatformStand = false
- end
- end
- end
- end
- function remove(child)
- child:Remove()
- end
- script.Parent.Touched:connect(ot)
- script.Parent.ChildAdded:connect(remove)
- end))
- Motor6D62.Name = "Waist"
- Motor6D62.Parent = MeshPart57
- Motor6D62.C0 = CFrame.new(0.00189745135, 3.63778567, -0.0966572911, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D62.C1 = CFrame.new(0.0022898186, -3.13879156, -0.105385743, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D62.Part0 = MeshPart23
- Motor6D62.Part1 = MeshPart57
- Motor6D62.part1 = MeshPart57
- Script63.Name = "Read me"
- Script63.Parent = Model0
- table.insert(cors,sandbox(Script63,function()
- --| Help for R15 model Zombie |--
- --
- -- To edit the zombie's damage go to LeftLowerArm/RightLowerArm > Damage Script > human.Health = human.Health - 5
- -- Edit the number to whatever you'd like
- -- The player will recieve damage from the LeftLowerArm and RightLowerArm
- -- To edit the walkspeed go to Humanoid > Scroll to the bottom > Edit the number shown after WalkSpeed
- -- You can also edit max health and spawn health under Humanoid > game
- --
- -- Have fun!
- --
- -- ImFarAway
- end))
- Part64.Name = "HumanoidRootPart"
- Part64.Parent = Model0
- Part64.CFrame = CFrame.new(-44.7772217, 15.7519035, 42.5431137, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
- Part64.Orientation = Vector3.new(0, -89.9599991, 0)
- Part64.Position = Vector3.new(-44.7772217, 15.7519035, 42.5431137)
- Part64.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
- Part64.Color = Color3.new(0.294118, 0.592157, 0.294118)
- Part64.Transparency = 1
- Part64.Size = Vector3.new(13.5449219, 13.5449219, 6.77246094)
- Part64.BrickColor = BrickColor.new("Bright green")
- Part64.CanCollide = false
- Part64.brickColor = BrickColor.new("Bright green")
- Vector3Value65.Name = "OriginalSize"
- Vector3Value65.Parent = Part64
- Vector3Value65.Value = Vector3.new(2, 2, 1)
- Script66.Name = "ShieldScript"
- Script66.Parent = Part64
- table.insert(cors,sandbox(Script66,function()
- function ot(hit)
- ch = hit:GetChildren()
- for i = 1, #ch do
- if ch[i].className == "BodyVelocity" then
- ch[i].velocity = ch[i].velocity*-1
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- if hit.Parent:FindFirstChild("Torso") ~= nil then
- hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- end
- hit.Parent.Humanoid.PlatformStand = true
- end
- else
- if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
- if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- else
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- wait(0.5)
- hit.Parent.Humanoid.PlatformStand = false
- end
- end
- end
- end
- function remove(child)
- child:Remove()
- end
- script.Parent.Touched:connect(ot)
- script.Parent.ChildAdded:connect(remove)
- end))
- Script67.Name = "Hurting"
- Script67.Parent = Part64
- table.insert(cors,sandbox(Script67,function()
- function onTouched(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if (humanoid ~= nil) then
- humanoid.Health = humanoid.Health - 25
- end
- end
- script.Parent.Touched:connect(onTouched)
- end))
- Part68.Name = "Scary Popup"
- Part68.Parent = Part64
- Part68.CFrame = CFrame.new(-42.9161453, 12.918376, 42.8049088, 1.29615285e-06, -6.0259481e-08, -1, -1.70004219e-10, 1, -6.0259481e-08, 1, 1.70082337e-10, 1.29615285e-06)
- Part68.Orientation = Vector3.new(0, -90, 0)
- Part68.Position = Vector3.new(-42.9161453, 12.918376, 42.8049088)
- Part68.Rotation = Vector3.new(0, -90, 0)
- Part68.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part68.Transparency = 1
- Part68.Size = Vector3.new(13.8900099, 25.7999935, 2.60000205)
- Part68.Anchored = true
- Part68.BrickColor = BrickColor.new("Dark stone grey")
- Part68.CanCollide = false
- Part68.brickColor = BrickColor.new("Dark stone grey")
- Part68.FormFactor = Enum.FormFactor.Custom
- Part68.formFactor = Enum.FormFactor.Custom
- Script69.Name = "ScaryScript"
- Script69.Parent = Part68
- table.insert(cors,sandbox(Script69,function()
- Sound = script.Parent.Scream
- Popup = script.Parent.Popup
- Ready = true
- function onTouch(hit)
- local h = hit.Parent:FindFirstChild("Humanoid")
- if h ~= nil and Ready == true then
- Ready = false
- local plyr = game.Players:FindFirstChild(h.Parent.Name)
- local c = Popup:clone()
- c.Parent = plyr.PlayerGui
- script.Parent.Scream:play()
- wait(7)
- c:remove()
- wait(1)
- Ready = true
- end
- end
- script.Parent.Touched:connect(onTouch)
- end))
- ScreenGui70.Name = "Popup"
- ScreenGui70.Parent = Part68
- Frame71.Name = "BackGround"
- Frame71.Parent = ScreenGui70
- Frame71.Transparency = 1
- Frame71.Size = UDim2.new(1, 1, 1, 1)
- Frame71.BackgroundColor = BrickColor.new("Black metallic")
- Frame71.BackgroundColor3 = Color3.new(0.109804, 0.109804, 0.109804)
- Frame71.BackgroundTransparency = 1
- ImageLabel72.Name = "Image"
- ImageLabel72.Parent = Frame71
- ImageLabel72.Transparency = 1
- ImageLabel72.Size = UDim2.new(1, 1, 1, 1)
- ImageLabel72.BackgroundColor = BrickColor.new("Really black")
- ImageLabel72.BackgroundColor3 = Color3.new(0, 0, 0)
- ImageLabel72.BackgroundTransparency = 1
- ImageLabel72.ImageTransparency = 1
- Sound73.Name = "Scream"
- Sound73.Parent = Part68
- Sound73.TimePosition = 0.3
- Sound73.EmitterSize = 500
- Sound73.MinDistance = 500
- Sound73.SoundId = "rbxassetid://154157312"
- Sound73.Volume = 10
- Script74.Name = "qPerfectionWeld"
- Script74.Parent = Part64
- table.insert(cors,sandbox(Script74,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))
- Part75.Name = "Head"
- Part75.Parent = Model0
- Part75.CFrame = CFrame.new(-44.7505646, 30.9169159, 42.5435677, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
- Part75.Orientation = Vector3.new(0, -89.9599991, 0)
- Part75.Position = Vector3.new(-44.7505646, 30.9169159, 42.5435677)
- Part75.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
- Part75.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part75.Size = Vector3.new(6.77246094, 6.77246094, 6.77246094)
- Part75.BottomSurface = Enum.SurfaceType.Smooth
- Part75.BrickColor = BrickColor.new("Bright yellow")
- Part75.TopSurface = Enum.SurfaceType.Smooth
- Part75.brickColor = BrickColor.new("Bright yellow")
- Part75.FormFactor = Enum.FormFactor.Custom
- Part75.formFactor = Enum.FormFactor.Custom
- Vector3Value76.Name = "OriginalSize"
- Vector3Value76.Parent = Part75
- Vector3Value76.Value = Vector3.new(1, 1, 1)
- Script77.Name = "ShieldScript"
- Script77.Parent = Part75
- table.insert(cors,sandbox(Script77,function()
- function ot(hit)
- ch = hit:GetChildren()
- for i = 1, #ch do
- if ch[i].className == "BodyVelocity" then
- ch[i].velocity = ch[i].velocity*-1
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- if hit.Parent:FindFirstChild("Torso") ~= nil then
- hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- end
- hit.Parent.Humanoid.PlatformStand = true
- end
- else
- if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
- if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- else
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- wait(0.5)
- hit.Parent.Humanoid.PlatformStand = false
- end
- end
- end
- end
- function remove(child)
- child:Remove()
- end
- script.Parent.Touched:connect(ot)
- script.Parent.ChildAdded:connect(remove)
- end))
- Script78.Name = "Hurting"
- Script78.Parent = Part75
- table.insert(cors,sandbox(Script78,function()
- function onTouched(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if (humanoid ~= nil) then
- humanoid.Health = humanoid.Health - 25
- end
- end
- script.Parent.Touched:connect(onTouched)
- end))
- SpecialMesh79.Parent = Part75
- SpecialMesh79.MeshId = "rbxassetid://1047997"
- SpecialMesh79.Scale = Vector3.new(6.03900242, 5.49000359, 5.79500103)
- SpecialMesh79.TextureId = "rbxassetid://1047998"
- SpecialMesh79.MeshType = Enum.MeshType.FileMesh
- Motor6D80.Name = "Neck"
- Motor6D80.Parent = Part75
- Motor6D80.C0 = CFrame.new(0.0022898186, 5.4588213, -0.105385743, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D80.C1 = CFrame.new(-0.000184275414, -3.83060861, 0.026188096, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D80.Part0 = MeshPart57
- Motor6D80.Part1 = Part75
- Motor6D80.part1 = Part75
- Script81.Name = "Sound"
- Script81.Parent = Model0
- table.insert(cors,sandbox(Script81,function()
- --[[
- Author: @spotco
- This script creates sounds which are placed under the character head.
- These sounds are used by the "LocalSound" script.
- To modify this script, copy it to your "StarterPlayer/StarterCharacterScripts" folder keeping the same script name ("Sound").
- The default Sound script loaded for every character will then be replaced with your copy of the script.
- ]]--
- function CreateNewSound(name, id, looped, pitch, parent)
- local sound = Instance.new("Sound")
- sound.SoundId = id
- sound.Name = name
- sound.archivable = false
- sound.Parent = parent
- sound.Pitch = pitch
- sound.Looped = looped
- sound.MinDistance = 5
- sound.MaxDistance = 150
- sound.Volume = 0.65
- return sound
- end
- local head = script.Parent:FindFirstChild("Head")
- if head == nil then
- error("Sound script parent has no child Head.")
- return
- end
- CreateNewSound("GettingUp", "rbxasset://sounds/action_get_up.mp3", false, 1, head)
- CreateNewSound("Died", "rbxasset://sounds/uuhhh.mp3", false, 1, head)
- CreateNewSound("FreeFalling", "rbxasset://sounds/action_falling.mp3", true, 1, head)
- CreateNewSound("Jumping", "rbxasset://sounds/action_jump.mp3", false, 1, head)
- CreateNewSound("Landing", "rbxasset://sounds/action_jump_land.mp3", false, 1, head)
- CreateNewSound("Splash", "rbxasset://sounds/impact_water.mp3", false, 1, head)
- CreateNewSound("Running", "rbxasset://sounds/action_footsteps_plastic.mp3", true, 1.85, head)
- CreateNewSound("Swimming", "rbxasset://sounds/action_swim.mp3", true, 1.6, head)
- CreateNewSound("Climbing", "rbxasset://sounds/action_footsteps_plastic.mp3", true, 1, head)
- end))
- Script82.Name = "LocalSound"
- Script82.Parent = Script81
- table.insert(cors,sandbox(Script82,function()
- --[[
- Author: @spotco
- This script runs locally for the player of the given humanoid.
- This script triggers humanoid sound play/pause actions locally.
- The Playing/TimePosition properties of Sound objects bypass FilteringEnabled, so this triggers the sound
- immediately for the player and is replicated to all other players.
- This script is optimized to reduce network traffic through minimizing the amount of property replication.
- ]]--
- --All sounds are referenced by this ID
- local SFX = {
- Died = 0;
- Running = 1;
- Swimming = 2;
- Climbing = 3,
- Jumping = 4;
- GettingUp = 5;
- FreeFalling = 6;
- FallingDown = 7;
- Landing = 8;
- Splash = 9;
- }
- local Humanoid = nil
- local Head = nil
- --SFX ID to Sound object
- local Sounds = {}
- do
- local Figure = script.Parent.Parent
- Head = Figure:WaitForChild("Head")
- while not Humanoid do
- for _,NewHumanoid in pairs(Figure:GetChildren()) do
- if NewHumanoid:IsA("Humanoid") then
- Humanoid = NewHumanoid
- break
- end
- end
- Figure.ChildAdded:wait()
- end
- Sounds[SFX.Died] = Head:WaitForChild("Died")
- Sounds[SFX.Running] = Head:WaitForChild("Running")
- Sounds[SFX.Swimming] = Head:WaitForChild("Swimming")
- Sounds[SFX.Climbing] = Head:WaitForChild("Climbing")
- Sounds[SFX.Jumping] = Head:WaitForChild("Jumping")
- Sounds[SFX.GettingUp] = Head:WaitForChild("GettingUp")
- Sounds[SFX.FreeFalling] = Head:WaitForChild("FreeFalling")
- Sounds[SFX.Landing] = Head:WaitForChild("Landing")
- Sounds[SFX.Splash] = Head:WaitForChild("Splash")
- end
- local Util
- Util = {
- --Define linear relationship between (pt1x,pt2x) and (pt2x,pt2y). Evaluate this at x.
- YForLineGivenXAndTwoPts = function(x,pt1x,pt1y,pt2x,pt2y)
- --(y - y1)/(x - x1) = m
- local m = (pt1y - pt2y) / (pt1x - pt2x)
- --float b = pt1.y - m * pt1.x;
- local b = (pt1y - m * pt1x)
- return m * x + b
- end;
- --Clamps the value of "val" between the "min" and "max"
- Clamp = function(val,min,max)
- return math.min(max,math.max(min,val))
- end;
- --Gets the horizontal (x,z) velocity magnitude of the given part
- HorizontalSpeed = function(Head)
- local hVel = Head.Velocity + Vector3.new(0,-Head.Velocity.Y,0)
- return hVel.magnitude
- end;
- --Gets the vertical (y) velocity magnitude of the given part
- VerticalSpeed = function(Head)
- return math.abs(Head.Velocity.Y)
- end;
- --Setting Playing/TimePosition values directly result in less network traffic than Play/Pause/Resume/Stop
- --If these properties are enabled, use them.
- Play = function(sound)
- if sound.TimePosition ~= 0 then
- sound.TimePosition = 0
- end
- if not sound.IsPlaying then
- sound.Playing = true
- end
- end;
- Pause = function(sound)
- if sound.IsPlaying then
- sound.Playing = false
- end
- end;
- Resume = function(sound)
- if not sound.IsPlaying then
- sound.Playing = true
- end
- end;
- Stop = function(sound)
- if sound.IsPlaying then
- sound.Playing = false
- end
- if sound.TimePosition ~= 0 then
- sound.TimePosition = 0
- end
- end;
- }
- do
- -- List of all active Looped sounds
- local playingLoopedSounds = {}
- -- Last seen Enum.HumanoidStateType
- local activeState = nil
- -- Verify and set that "sound" is in "playingLoopedSounds".
- function setSoundInPlayingLoopedSounds(sound)
- for i=1, #playingLoopedSounds do
- if playingLoopedSounds[i] == sound then
- return
- end
- end
- table.insert(playingLoopedSounds,sound)
- end
- -- Stop all active looped sounds except parameter "except". If "except" is not passed, all looped sounds will be stopped.
- function stopPlayingLoopedSoundsExcept(except)
- for i=#playingLoopedSounds,1,-1 do
- if playingLoopedSounds[i] ~= except then
- Util.Pause(playingLoopedSounds[i])
- table.remove(playingLoopedSounds,i)
- end
- end
- end
- -- Table of Enum.HumanoidStateType to handling function
- local stateUpdateHandler = {
- [Enum.HumanoidStateType.Dead] = function()
- stopPlayingLoopedSoundsExcept()
- local sound = Sounds[SFX.Died]
- Util.Play(sound)
- end;
- [Enum.HumanoidStateType.RunningNoPhysics] = function()
- stateUpdated(Enum.HumanoidStateType.Running)
- end;
- [Enum.HumanoidStateType.Running] = function()
- local sound = Sounds[SFX.Running]
- stopPlayingLoopedSoundsExcept(sound)
- if Util.HorizontalSpeed(Head) > 0.5 then
- Util.Resume(sound)
- setSoundInPlayingLoopedSounds(sound)
- else
- stopPlayingLoopedSoundsExcept()
- end
- end;
- [Enum.HumanoidStateType.Swimming] = function()
- if activeState ~= Enum.HumanoidStateType.Swimming and Util.VerticalSpeed(Head) > 0.1 then
- local splashSound = Sounds[SFX.Splash]
- splashSound.Volume = Util.Clamp(
- Util.YForLineGivenXAndTwoPts(
- Util.VerticalSpeed(Head),
- 100, 0.28,
- 350, 1),
- 0,1)
- Util.Play(splashSound)
- end
- do
- local sound = Sounds[SFX.Swimming]
- stopPlayingLoopedSoundsExcept(sound)
- Util.Resume(sound)
- setSoundInPlayingLoopedSounds(sound)
- end
- end;
- [Enum.HumanoidStateType.Climbing] = function()
- local sound = Sounds[SFX.Climbing]
- if Util.VerticalSpeed(Head) > 0.1 then
- Util.Resume(sound)
- stopPlayingLoopedSoundsExcept(sound)
- else
- stopPlayingLoopedSoundsExcept()
- end
- setSoundInPlayingLoopedSounds(sound)
- end;
- [Enum.HumanoidStateType.Jumping] = function()
- if activeState == Enum.HumanoidStateType.Jumping then
- return
- end
- stopPlayingLoopedSoundsExcept()
- local sound = Sounds[SFX.Jumping]
- Util.Play(sound)
- end;
- [Enum.HumanoidStateType.GettingUp] = function()
- stopPlayingLoopedSoundsExcept()
- local sound = Sounds[SFX.GettingUp]
- Util.Play(sound)
- end;
- [Enum.HumanoidStateType.Freefall] = function()
- if activeState == Enum.HumanoidStateType.Freefall then
- return
- end
- local sound = Sounds[SFX.FreeFalling]
- sound.Volume = 0
- stopPlayingLoopedSoundsExcept()
- end;
- [Enum.HumanoidStateType.FallingDown] = function()
- stopPlayingLoopedSoundsExcept()
- end;
- [Enum.HumanoidStateType.Landed] = function()
- stopPlayingLoopedSoundsExcept()
- if Util.VerticalSpeed(Head) > 75 then
- local landingSound = Sounds[SFX.Landing]
- landingSound.Volume = Util.Clamp(
- Util.YForLineGivenXAndTwoPts(
- Util.VerticalSpeed(Head),
- 50, 0,
- 100, 1),
- 0,1)
- Util.Play(landingSound)
- end
- end
- }
- -- Handle state event fired or OnChange fired
- function stateUpdated(state)
- if stateUpdateHandler[state] ~= nil then
- stateUpdateHandler[state]()
- end
- activeState = state
- end
- Humanoid.Died:connect( function() stateUpdated(Enum.HumanoidStateType.Dead) end)
- Humanoid.Running:connect( function() stateUpdated(Enum.HumanoidStateType.Running) end)
- Humanoid.Swimming:connect( function() stateUpdated(Enum.HumanoidStateType.Swimming) end)
- Humanoid.Climbing:connect( function() stateUpdated(Enum.HumanoidStateType.Climbing) end)
- Humanoid.Jumping:connect( function() stateUpdated(Enum.HumanoidStateType.Jumping) end)
- Humanoid.GettingUp:connect( function() stateUpdated(Enum.HumanoidStateType.GettingUp) end)
- Humanoid.FreeFalling:connect( function() stateUpdated(Enum.HumanoidStateType.Freefall) end)
- Humanoid.FallingDown:connect( function() stateUpdated(Enum.HumanoidStateType.FallingDown) end)
- -- required for proper handling of Landed event
- Humanoid.StateChanged:connect(function(old, new)
- stateUpdated(new)
- end)
- function onUpdate(stepDeltaSeconds, tickSpeedSeconds)
- local stepScale = stepDeltaSeconds / tickSpeedSeconds
- do
- local sound = Sounds[SFX.FreeFalling]
- if activeState == Enum.HumanoidStateType.Freefall then
- if Head.Velocity.Y < 0 and Util.VerticalSpeed(Head) > 75 then
- Util.Resume(sound)
- --Volume takes 1.1 seconds to go from volume 0 to 1
- local ANIMATION_LENGTH_SECONDS = 1.1
- local normalizedIncrement = tickSpeedSeconds / ANIMATION_LENGTH_SECONDS
- sound.Volume = Util.Clamp(sound.Volume + normalizedIncrement * stepScale, 0, 1)
- else
- sound.Volume = 0
- end
- else
- Util.Pause(sound)
- end
- end
- do
- local sound = Sounds[SFX.Running]
- if activeState == Enum.HumanoidStateType.Running then
- if Util.HorizontalSpeed(Head) < 0.5 then
- Util.Pause(sound)
- end
- end
- end
- end
- local lastTick = tick()
- local TICK_SPEED_SECONDS = 0.25
- while true do
- onUpdate(tick() - lastTick,TICK_SPEED_SECONDS)
- lastTick = tick()
- wait(TICK_SPEED_SECONDS)
- end
- end
- end))
- Script83.Name = "Animate"
- Script83.Parent = Model0
- table.insert(cors,sandbox(Script83,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 Humanoid = waitForChild(Figure, "NPC")
- local pose = "Standing"
- local currentAnim = ""
- local currentAnimInstance = nil
- local currentAnimTrack = nil
- local currentAnimKeyframeHandler = nil
- local currentAnimSpeed = 0.1
- local animTable = {}
- local animNames = {
- idle = {
- { id = "http://www.roblox.com/asset/?id=507766666", weight = 1 },
- { id = "http://www.roblox.com/asset/?id=507766951", weight = 1 },
- { id = "http://www.roblox.com/asset/?id=507766388", weight = 9 }
- },
- walk = {
- { id = "http://www.roblox.com/asset/?id=507777826", weight = 10 }
- },
- run = {
- { id = "http://www.roblox.com/asset/?id=507767714", weight = 10 }
- },
- swim = {
- { id = "http://www.roblox.com/asset/?id=507784897", weight = 10 }
- },
- swimidle = {
- { id = "http://www.roblox.com/asset/?id=507785072", weight = 10 }
- },
- jump = {
- { id = "http://www.roblox.com/asset/?id=507765000", weight = 10 }
- },
- fall = {
- { id = "http://www.roblox.com/asset/?id=507767968", weight = 10 }
- },
- climb = {
- { id = "http://www.roblox.com/asset/?id=507765644", weight = 10 }
- },
- sit = {
- { id = "http://www.roblox.com/asset/?id=507768133", weight = 10 }
- },
- toolnone = {
- { id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
- },
- toolslash = {
- { id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
- -- { id = "slash.xml", weight = 10 }
- },
- toollunge = {
- { id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
- },
- wave = {
- { id = "http://www.roblox.com/asset/?id=507770239", weight = 10 }
- },
- point = {
- { id = "http://www.roblox.com/asset/?id=507770453", weight = 10 }
- },
- dance = {
- { id = "http://www.roblox.com/asset/?id=507771019", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=507771955", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=507772104", weight = 10 }
- },
- dance2 = {
- { id = "http://www.roblox.com/asset/?id=507776043", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=507776720", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=507776879", weight = 10 }
- },
- dance3 = {
- { id = "http://www.roblox.com/asset/?id=507777268", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=507777451", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=507777623", weight = 10 }
- },
- laugh = {
- { id = "http://www.roblox.com/asset/?id=507770818", weight = 10 }
- },
- cheer = {
- { id = "http://www.roblox.com/asset/?id=507770677", weight = 10 }
- },
- }
- -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
- local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
- math.randomseed(tick())
- function configureAnimationSet(name, fileList)
- if (animTable[name] ~= nil) then
- for _, connection in pairs(animTable[name].connections) do
- connection:disconnect()
- end
- end
- animTable[name] = {}
- animTable[name].count = 0
- animTable[name].totalWeight = 0
- animTable[name].connections = {}
- -- check for config values
- local config = script:FindFirstChild(name)
- if (config ~= nil) then
- -- print("Loading anims " .. name)
- table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
- table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
- local idx = 1
- for _, childPart in pairs(config:GetChildren()) do
- if (childPart:IsA("Animation")) then
- table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
- animTable[name][idx] = {}
- animTable[name][idx].anim = childPart
- local weightObject = childPart:FindFirstChild("Weight")
- if (weightObject == nil) then
- animTable[name][idx].weight = 1
- else
- animTable[name][idx].weight = weightObject.Value
- end
- animTable[name].count = animTable[name].count + 1
- animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
- -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
- idx = idx + 1
- end
- end
- end
- -- fallback to defaults
- if (animTable[name].count <= 0) then
- for idx, anim in pairs(fileList) do
- animTable[name][idx] = {}
- animTable[name][idx].anim = Instance.new("Animation")
- animTable[name][idx].anim.Name = name
- animTable[name][idx].anim.AnimationId = anim.id
- animTable[name][idx].weight = anim.weight
- animTable[name].count = animTable[name].count + 1
- animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
- -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
- end
- end
- end
- -- Setup animation objects
- function scriptChildModified(child)
- local fileList = animNames[child.Name]
- if (fileList ~= nil) then
- configureAnimationSet(child.Name, fileList)
- end
- end
- script.ChildAdded:connect(scriptChildModified)
- script.ChildRemoved:connect(scriptChildModified)
- for name, fileList in pairs(animNames) do
- configureAnimationSet(name, fileList)
- end
- -- ANIMATION
- -- declarations
- local toolAnim = "None"
- local toolAnimTime = 0
- local jumpAnimTime = 3
- local jumpAnimDuration = 0.31
- local toolTransitionTime = 0.1
- local fallTransitionTime = 0.2
- -- 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(0.8)
- end
- end
- function keyFrameReachedFunc(frameName)
- if (frameName == "End") then
- -- print("Keyframe : ".. frameName)
- 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.15, Humanoid)
- setAnimationSpeed(0.8)
- 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 = 0.5
- -- 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
- local scale = 15.0
- playAnimation("walk", 0.1, Humanoid)
- setAnimationSpeed(speed / scale)
- 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)
- local scale = 5.0
- playAnimation("climb", 0.1, Humanoid)
- setAnimationSpeed(speed / scale)
- 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 > 1.00 then
- local scale = 10.0
- playAnimation("swim", 0.4, Humanoid)
- setAnimationSpeed(speed / scale)
- pose = "Swimming"
- else
- playAnimation("swimidle", 0.4, Humanoid)
- 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
- -- Tool Animation handling
- local tool = getTool()
- if tool then
- animStringValueObject = getToolAnim(tool)
- if animStringValueObject then
- toolAnim = animStringValueObject.Value
- -- message recieved, delete StringValue
- animStringValueObject.Parent = nil
- toolAnimTime = time + .3
- end
- if time > toolAnimTime then
- toolAnimTime = 0
- toolAnim = "None"
- end
- animateTool()
- else
- stopToolAnimations()
- toolAnim = "None"
- 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
- script.msg.Changed:connect(function(msg)
- script.msg.Value = ""
- local emote = ""
- if (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
- -- print("===> " .. string.sub(msg, 1, 3) .. "(" .. emote .. ")")
- end)
- -- main program
- local runService = game:service("RunService");
- -- print("bottom")
- -- initialize to idle
- playAnimation("idle", 0.1, Humanoid)
- pose = "Standing"
- while Figure.Parent~=nil do
- local _, time = wait(0.1)
- move(time)
- end
- end))
- StringValue84.Name = "cheer"
- StringValue84.Parent = Script83
- Animation85.Name = "CheerAnim"
- Animation85.Parent = StringValue84
- Animation85.AnimationId = "http://www.roblox.com/asset/?id=507770677"
- StringValue86.Name = "climb"
- StringValue86.Parent = Script83
- Animation87.Name = "ClimbAnim"
- Animation87.Parent = StringValue86
- Animation87.AnimationId = "http://www.roblox.com/asset/?id=742636889"
- StringValue88.Name = "dance"
- StringValue88.Parent = Script83
- Animation89.Name = "Animation1"
- Animation89.Parent = StringValue88
- Animation89.AnimationId = "http://www.roblox.com/asset/?id=507771019"
- NumberValue90.Name = "Weight"
- NumberValue90.Parent = Animation89
- NumberValue90.Value = 10
- Animation91.Name = "Animation2"
- Animation91.Parent = StringValue88
- Animation91.AnimationId = "http://www.roblox.com/asset/?id=507771955"
- NumberValue92.Name = "Weight"
- NumberValue92.Parent = Animation91
- NumberValue92.Value = 10
- Animation93.Name = "Animation3"
- Animation93.Parent = StringValue88
- Animation93.AnimationId = "http://www.roblox.com/asset/?id=507772104"
- NumberValue94.Name = "Weight"
- NumberValue94.Parent = Animation93
- NumberValue94.Value = 10
- StringValue95.Name = "dance2"
- StringValue95.Parent = Script83
- Animation96.Name = "Animation1"
- Animation96.Parent = StringValue95
- Animation96.AnimationId = "http://www.roblox.com/asset/?id=507776043"
- NumberValue97.Name = "Weight"
- NumberValue97.Parent = Animation96
- NumberValue97.Value = 10
- Animation98.Name = "Animation2"
- Animation98.Parent = StringValue95
- Animation98.AnimationId = "http://www.roblox.com/asset/?id=507776720"
- NumberValue99.Name = "Weight"
- NumberValue99.Parent = Animation98
- NumberValue99.Value = 10
- Animation100.Name = "Animation3"
- Animation100.Parent = StringValue95
- Animation100.AnimationId = "http://www.roblox.com/asset/?id=507776879"
- NumberValue101.Name = "Weight"
- NumberValue101.Parent = Animation100
- NumberValue101.Value = 10
- StringValue102.Name = "dance3"
- StringValue102.Parent = Script83
- Animation103.Name = "Animation1"
- Animation103.Parent = StringValue102
- Animation103.AnimationId = "http://www.roblox.com/asset/?id=507777268"
- NumberValue104.Name = "Weight"
- NumberValue104.Parent = Animation103
- NumberValue104.Value = 10
- Animation105.Name = "Animation2"
- Animation105.Parent = StringValue102
- Animation105.AnimationId = "http://www.roblox.com/asset/?id=507777451"
- NumberValue106.Name = "Weight"
- NumberValue106.Parent = Animation105
- NumberValue106.Value = 10
- Animation107.Name = "Animation3"
- Animation107.Parent = StringValue102
- Animation107.AnimationId = "http://www.roblox.com/asset/?id=507777623"
- NumberValue108.Name = "Weight"
- NumberValue108.Parent = Animation107
- NumberValue108.Value = 10
- StringValue109.Name = "fall"
- StringValue109.Parent = Script83
- Animation110.Name = "FallAnim"
- Animation110.Parent = StringValue109
- Animation110.AnimationId = "http://www.roblox.com/asset/?id=742637151"
- StringValue111.Name = "idle"
- StringValue111.Parent = Script83
- Animation112.Name = "Animation1"
- Animation112.Parent = StringValue111
- Animation112.AnimationId = "http://www.roblox.com/asset/?id=742637544"
- NumberValue113.Name = "Weight"
- NumberValue113.Parent = Animation112
- NumberValue113.Value = 9
- Animation114.Name = "Animation2"
- Animation114.Parent = StringValue111
- Animation114.AnimationId = "http://www.roblox.com/asset/?id=742638445"
- NumberValue115.Name = "Weight"
- NumberValue115.Parent = Animation114
- NumberValue115.Value = 1
- StringValue116.Name = "jump"
- StringValue116.Parent = Script83
- Animation117.Name = "!ID!"
- Animation117.Parent = StringValue116
- Animation117.AnimationId = "http://www.roblox.com/asset/?id=742637942"
- StringValue118.Name = "laugh"
- StringValue118.Parent = Script83
- Animation119.Name = "LaughAnim"
- Animation119.Parent = StringValue118
- Animation119.AnimationId = "http://www.roblox.com/asset/?id=507770818"
- StringValue120.Name = "point"
- StringValue120.Parent = Script83
- Animation121.Name = "PointAnim"
- Animation121.Parent = StringValue120
- Animation121.AnimationId = "http://www.roblox.com/asset/?id=507770453"
- StringValue122.Name = "run"
- StringValue122.Parent = Script83
- Animation123.Name = "RunAnim"
- Animation123.Parent = StringValue122
- Animation123.AnimationId = "http://www.roblox.com/asset/?id=742638842"
- StringValue124.Name = "sit"
- StringValue124.Parent = Script83
- Animation125.Name = "SitAnim"
- Animation125.Parent = StringValue124
- Animation125.AnimationId = "http://www.roblox.com/asset/?id=507768133"
- StringValue126.Name = "swim"
- StringValue126.Parent = Script83
- Animation127.Name = "Swim"
- Animation127.Parent = StringValue126
- Animation127.AnimationId = "http://www.roblox.com/asset/?id=742639220"
- StringValue128.Name = "swimidle"
- StringValue128.Parent = Script83
- Animation129.Name = "SwimIdle"
- Animation129.Parent = StringValue128
- Animation129.AnimationId = "http://www.roblox.com/asset/?id=742639812"
- StringValue130.Name = "toollunge"
- StringValue130.Parent = Script83
- Animation131.Name = "ToolLungeAnim"
- Animation131.Parent = StringValue130
- Animation131.AnimationId = "http://www.roblox.com/asset/?id=507768375"
- StringValue132.Name = "toolnone"
- StringValue132.Parent = Script83
- Animation133.Name = "ToolNoneAnim"
- Animation133.Parent = StringValue132
- Animation133.AnimationId = "http://www.roblox.com/asset/?id=507768375"
- StringValue134.Name = "toolslash"
- StringValue134.Parent = Script83
- Animation135.Name = "ToolSlashAnim"
- Animation135.Parent = StringValue134
- Animation135.AnimationId = "http://www.roblox.com/asset/?id=507768375"
- StringValue136.Name = "walk"
- StringValue136.Parent = Script83
- Animation137.Name = "WalkAnim"
- Animation137.Parent = StringValue136
- Animation137.AnimationId = "http://www.roblox.com/asset/?id=742640026"
- StringValue138.Name = "wave"
- StringValue138.Parent = Script83
- Animation139.Name = "WaveAnim"
- Animation139.Parent = StringValue138
- Animation139.AnimationId = "http://www.roblox.com/asset/?id=507770239"
- Script140.Name = "Health"
- Script140.Parent = Model0
- table.insert(cors,sandbox(Script140,function()
- --Responsible for regening a player's humanoid's health
- -- declarations
- local Figure = script.Parent
- local Head = Figure:WaitForChild("Head")
- local Humanoid = Figure:WaitForChild("NPC")
- local regening = false
- -- regeneration
- function regenHealth()
- if regening then return end
- regening = true
- while Humanoid.Health < Humanoid.MaxHealth do
- local s = wait(1)
- local health = Humanoid.Health
- if health > 0 and health < Humanoid.MaxHealth then
- local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
- health = health + newHealthDelta
- Humanoid.Health = math.min(health,Humanoid.MaxHealth)
- end
- end
- if Humanoid.Health > Humanoid.MaxHealth then
- Humanoid.Health = Humanoid.MaxHealth
- end
- regening = false
- end
- Humanoid.HealthChanged:connect(regenHealth)
- end))
- Script141.Parent = Model0
- table.insert(cors,sandbox(Script141,function()
- local larm = script.Parent:FindFirstChild("HumanoidRootPart")
- local rarm = script.Parent:FindFirstChild("HumanoidRootPart")
- function findNearestTorso(pos)
- local list = game.Workspace:children()
- local torso = nil
- local dist = 3500
- local temp = nil
- local human = nil
- local temp2 = nil
- for x = 1, #list do
- temp2 = list[x]
- if (temp2.className == "Model") and (temp2 ~= script.Parent) then
- temp = temp2:findFirstChild("HumanoidRootPart")
- human = temp2:findFirstChild("Humanoid")
- if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
- if (temp.Position - pos).magnitude < dist then
- torso = temp
- dist = (temp.Position - pos).magnitude
- end
- end
- end
- end
- return torso
- end
- while true do
- wait(math.random(1,5))
- local target = findNearestTorso(script.Parent.HumanoidRootPart.Position)
- if target ~= nil then
- script.Parent.NPC:MoveTo(target.Position, target)
- end
- end
- end))
- Script142.Name = "SprintScriptImporter"
- Script142.Parent = Model0
- table.insert(cors,sandbox(Script142,function()
- function onPlayerEntered(player)
- repeat wait () until player.Character ~= nil
- local s = script.SprintScript:clone()
- s.Parent = player.Character
- s.Disabled = false
- player.CharacterAdded:connect(function (char)
- local s = script.SprintScript:clone()
- s.Parent = char
- s.Disabled = false
- end)
- end
- game.Players.PlayerAdded:connect(onPlayerEntered) -- Go to Children and do SprintScript to edit the speed
- end))
- LocalScript143.Name = "SprintScript"
- LocalScript143.Parent = Script142
- table.insert(cors,sandbox(LocalScript143,function()
- local mouse = game.Players.LocalPlayer:GetMouse()
- local running = false
- function getTool()
- for _, kid in ipairs(script.Parent:GetChildren()) do
- if kid.className == "Tool" then return kid end
- end
- return nil
- end
- mouse.KeyDown:connect(function (key) -- Run function
- key = string.lower(key)
- if string.byte(key) == 48 then
- running = true
- local keyConnection = mouse.KeyUp:connect(function (key)
- if string.byte(key) == 48 then
- running = false
- end
- end)
- for i = 1,5 do
- game.Workspace.CurrentCamera.FieldOfView = (70+(i*2))
- wait()
- end
- game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 40 -- Edit this to what you want while sprinting
- repeat wait () until running == false
- keyConnection:disconnect()
- game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
- for i = 1,5 do
- game.Workspace.CurrentCamera.FieldOfView = (80-(i*2))
- wait()
- end
- end
- end) -- TheSecondPower
- end))
- LocalScript143.Disabled = true
- Script144.Name = "SuperRun"
- Script144.Parent = Model0
- table.insert(cors,sandbox(Script144,function()
- function makeRun(character)
- local h = character:FindFirstChild("Humanoid")
- if (h~= nil) then
- h.WalkSpeed = 46
- end
- end
- function onPlayerRespawn(property, player)
- -- need to connect to new humanoid
- if property == "Character" and player.Character ~= nil then
- makeRun(player.Character)
- end
- end
- function onPlayerEntered(newPlayer)
- -- VERY UGLY HACK
- -- Will this leak threads?
- -- Is the problem even what I think it is (player arrived before character)?
- while true do
- if newPlayer.Character ~= nil then break end
- wait(1)
- end
- -- start to listen for new humanoid
- newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end )
- makeRun(newPlayer.Character)
- end
- game.Players.ChildAdded:connect(onPlayerEntered)
- end))
- ObjectValue145.Name = "IsNZ"
- ObjectValue145.Parent = Model0
- MeshPart146.Name = "LeftFoot"
- MeshPart146.Parent = Model0
- MeshPart146.CFrame = CFrame.new(-44.8833466, 1.13603067, 39.1852455, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
- MeshPart146.Orientation = Vector3.new(0, -89.9599991, 0)
- MeshPart146.Position = Vector3.new(-44.8833466, 1.13603067, 39.1852455)
- MeshPart146.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
- MeshPart146.Color = Color3.new(0.294118, 0.592157, 0.294118)
- MeshPart146.Size = Vector3.new(6.77673674, 2.27153254, 6.77383852)
- MeshPart146.BrickColor = BrickColor.new("Bright green")
- MeshPart146.CanCollide = false
- MeshPart146.brickColor = BrickColor.new("Bright green")
- Vector3Value147.Name = "OriginalSize"
- Vector3Value147.Parent = MeshPart146
- Vector3Value147.Value = Vector3.new(1.00063133, 0.335407257, 1.00020337)
- Script148.Name = "ShieldScript"
- Script148.Parent = MeshPart146
- table.insert(cors,sandbox(Script148,function()
- function ot(hit)
- ch = hit:GetChildren()
- for i = 1, #ch do
- if ch[i].className == "BodyVelocity" then
- ch[i].velocity = ch[i].velocity*-1
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- if hit.Parent:FindFirstChild("Torso") ~= nil then
- hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
- end
- hit.Parent.Humanoid.PlatformStand = true
- end
- else
- if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
- if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- else
- hit:breakJoints()
- if hit.Anchored == false then
- hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
- end
- end
- end
- end
- if hit.Parent ~= nil then
- if hit.Parent:FindFirstChild("Humanoid") ~= nil then
- if hit.Parent ~= script.Parent.Parent then
- wait(0.5)
- hit.Parent.Humanoid.PlatformStand = false
- end
- end
- end
- end
- function remove(child)
- child:Remove()
- end
- script.Parent.Touched:connect(ot)
- script.Parent.ChildAdded:connect(remove)
- end))
- Script149.Name = "Hurting"
- Script149.Parent = MeshPart146
- table.insert(cors,sandbox(Script149,function()
- function onTouched(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if (humanoid ~= nil) then
- humanoid.Health = humanoid.Health - 25
- end
- end
- script.Parent.Touched:connect(onTouched)
- end))
- Script150.Name = "qPerfectionWeld"
- Script150.Parent = MeshPart146
- table.insert(cors,sandbox(Script150,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))
- Motor6D151.Name = "LeftAnkle"
- Motor6D151.Parent = MeshPart146
- Motor6D151.C0 = CFrame.new(-0.0259127952, -4.80933714, 0.00206926349, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D151.C1 = CFrame.new(-0.0610660091, 0.21972087, 0.00120258378, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Motor6D151.Part0 = MeshPart14
- Motor6D151.Part1 = MeshPart146
- Motor6D151.part1 = MeshPart146
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = workspace
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement