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")
- Model1 = Instance.new("Model")
- Part2 = Instance.new("Part")
- SpecialMesh3 = Instance.new("SpecialMesh")
- Dialog4 = Instance.new("Dialog")
- DialogChoice5 = Instance.new("DialogChoice")
- DialogChoice6 = Instance.new("DialogChoice")
- DialogChoice7 = Instance.new("DialogChoice")
- Decal8 = Instance.new("Decal")
- Part9 = Instance.new("Part")
- Decal10 = Instance.new("Decal")
- Motor6D11 = Instance.new("Motor6D")
- Motor6D12 = Instance.new("Motor6D")
- Motor6D13 = Instance.new("Motor6D")
- Motor6D14 = Instance.new("Motor6D")
- Motor6D15 = Instance.new("Motor6D")
- Part16 = Instance.new("Part")
- Part17 = Instance.new("Part")
- Part18 = Instance.new("Part")
- Part19 = Instance.new("Part")
- Humanoid20 = Instance.new("Humanoid")
- Part21 = Instance.new("Part")
- Motor6D22 = Instance.new("Motor6D")
- Script23 = Instance.new("Script")
- LocalScript24 = Instance.new("LocalScript")
- Script25 = Instance.new("Script")
- BodyColors26 = Instance.new("BodyColors")
- ShirtGraphic27 = Instance.new("ShirtGraphic")
- Script28 = Instance.new("Script")
- Script29 = Instance.new("Script")
- Script30 = Instance.new("Script")
- StringValue31 = Instance.new("StringValue")
- Animation32 = Instance.new("Animation")
- StringValue33 = Instance.new("StringValue")
- Animation34 = Instance.new("Animation")
- StringValue35 = Instance.new("StringValue")
- Animation36 = Instance.new("Animation")
- NumberValue37 = Instance.new("NumberValue")
- Animation38 = Instance.new("Animation")
- NumberValue39 = Instance.new("NumberValue")
- StringValue40 = Instance.new("StringValue")
- Animation41 = Instance.new("Animation")
- StringValue42 = Instance.new("StringValue")
- Animation43 = Instance.new("Animation")
- StringValue44 = Instance.new("StringValue")
- Animation45 = Instance.new("Animation")
- StringValue46 = Instance.new("StringValue")
- Animation47 = Instance.new("Animation")
- Script48 = Instance.new("Script")
- Script49 = Instance.new("Script")
- Model0.Name = "Talking Noob"
- Model0.Parent = mas
- Model1.Name = "Noob"
- Model1.Parent = Model0
- Model1.PrimaryPart = Part2
- Part2.Name = "Head"
- Part2.Parent = Model1
- Part2.CFrame = CFrame.new(-8.56659603, 4.50001431, 72.4827576, -0.964122772, 0, 0.265456945, 0, 1, 0, -0.265456945, 0, -0.964122772)
- Part2.Orientation = Vector3.new(0, 164.610001, 0)
- Part2.Position = Vector3.new(-8.56659603, 4.50001431, 72.4827576)
- Part2.Rotation = Vector3.new(-180, 15.3899994, -180)
- Part2.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part2.Size = Vector3.new(2, 1, 1)
- Part2.BrickColor = BrickColor.new("Bright yellow")
- Part2.TopSurface = Enum.SurfaceType.Smooth
- Part2.brickColor = BrickColor.new("Bright yellow")
- Part2.FormFactor = Enum.FormFactor.Symmetric
- Part2.formFactor = Enum.FormFactor.Symmetric
- SpecialMesh3.Parent = Part2
- SpecialMesh3.Scale = Vector3.new(1.25, 1.25, 1.25)
- Dialog4.Parent = Part2
- Dialog4.GoodbyeDialog = "Uhh bye."
- Dialog4.InitialPrompt = "H1"
- Dialog4.Purpose = Enum.DialogPurpose.Quest
- Dialog4.Tone = Enum.DialogTone.Friendly
- DialogChoice5.Parent = Dialog4
- DialogChoice5.GoodbyeDialog = "Erm bye"
- DialogChoice5.ResponseDialog = "W4nn4 b3 fr13nd5"
- DialogChoice5.UserDialog = "Hi..?"
- DialogChoice6.Parent = DialogChoice5
- DialogChoice6.GoodbyeDialog = "...Bye"
- DialogChoice6.ResponseDialog = "0M6 1'M R3P0R71N6 U 4ND BU1LD3RM4N 15 MY D4D!!!!!!1111"
- DialogChoice6.UserDialog = "No"
- DialogChoice7.Parent = DialogChoice5
- DialogChoice7.ResponseDialog = "Y4y!"
- DialogChoice7.UserDialog = "Sure"
- Decal8.Parent = Part2
- Decal8.Texture = "http://www.roblox.com/asset/?id=149118265"
- Part9.Name = "Torso"
- Part9.Parent = Model1
- Part9.CFrame = CFrame.new(-8.56659603, 3.00001407, 72.4827576, -0.964122772, 0, 0.265456945, 0, 1, 0, -0.265456945, 0, -0.964122772)
- Part9.Orientation = Vector3.new(0, 164.610001, 0)
- Part9.Position = Vector3.new(-8.56659603, 3.00001407, 72.4827576)
- Part9.Rotation = Vector3.new(-180, 15.3899994, -180)
- Part9.Color = Color3.new(0.0509804, 0.411765, 0.67451)
- Part9.Size = Vector3.new(2, 2, 1)
- Part9.BrickColor = BrickColor.new("Bright blue")
- Part9.LeftParamA = 0
- Part9.LeftParamB = 0
- Part9.LeftSurface = Enum.SurfaceType.Weld
- Part9.RightParamA = 0
- Part9.RightParamB = 0
- Part9.RightSurface = Enum.SurfaceType.Weld
- Part9.brickColor = BrickColor.new("Bright blue")
- Part9.FormFactor = Enum.FormFactor.Symmetric
- Part9.formFactor = Enum.FormFactor.Symmetric
- Decal10.Name = "roblox"
- Decal10.Parent = Part9
- Decal10.Texture = "http://www.roblox.com/asset/?id=236928940"
- Motor6D11.Name = "Right Shoulder"
- Motor6D11.Parent = Part9
- Motor6D11.MaxVelocity = 0.10000000149012
- Motor6D11.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D11.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D11.Part0 = Part9
- Motor6D11.Part1 = Part17
- Motor6D11.part1 = Part17
- Motor6D12.Name = "Left Shoulder"
- Motor6D12.Parent = Part9
- Motor6D12.MaxVelocity = 0.10000000149012
- Motor6D12.C0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D12.C1 = CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D12.Part0 = Part9
- Motor6D12.Part1 = Part16
- Motor6D12.part1 = Part16
- Motor6D13.Name = "Right Hip"
- Motor6D13.Parent = Part9
- Motor6D13.MaxVelocity = 0.10000000149012
- Motor6D13.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D13.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D13.Part0 = Part9
- Motor6D13.Part1 = Part19
- Motor6D13.part1 = Part19
- Motor6D14.Name = "Left Hip"
- Motor6D14.Parent = Part9
- Motor6D14.MaxVelocity = 0.10000000149012
- Motor6D14.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D14.C1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D14.Part0 = Part9
- Motor6D14.Part1 = Part18
- Motor6D14.part1 = Part18
- Motor6D15.Name = "Neck"
- Motor6D15.Parent = Part9
- Motor6D15.MaxVelocity = 0.10000000149012
- Motor6D15.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D15.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D15.Part0 = Part9
- Motor6D15.Part1 = Part2
- Motor6D15.part1 = Part2
- Part16.Name = "Left Arm"
- Part16.Parent = Model1
- Part16.CFrame = CFrame.new(-7.12041187, 3.00001407, 72.8809433, -0.964122772, 0, 0.265456945, 0, 1, 0, -0.265456945, 0, -0.964122772)
- Part16.Orientation = Vector3.new(0, 164.610001, 0)
- Part16.Position = Vector3.new(-7.12041187, 3.00001407, 72.8809433)
- Part16.Rotation = Vector3.new(-180, 15.3899994, -180)
- Part16.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part16.Size = Vector3.new(1, 2, 1)
- Part16.BrickColor = BrickColor.new("Bright yellow")
- Part16.CanCollide = false
- Part16.brickColor = BrickColor.new("Bright yellow")
- Part16.FormFactor = Enum.FormFactor.Symmetric
- Part16.formFactor = Enum.FormFactor.Symmetric
- Part17.Name = "Right Arm"
- Part17.Parent = Model1
- Part17.CFrame = CFrame.new(-10.0127802, 3.00001407, 72.0845718, -0.964122772, 0, 0.265456945, 0, 1, 0, -0.265456945, 0, -0.964122772)
- Part17.Orientation = Vector3.new(0, 164.610001, 0)
- Part17.Position = Vector3.new(-10.0127802, 3.00001407, 72.0845718)
- Part17.Rotation = Vector3.new(-180, 15.3899994, -180)
- Part17.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part17.Size = Vector3.new(1, 2, 1)
- Part17.BrickColor = BrickColor.new("Bright yellow")
- Part17.CanCollide = false
- Part17.brickColor = BrickColor.new("Bright yellow")
- Part17.FormFactor = Enum.FormFactor.Symmetric
- Part17.formFactor = Enum.FormFactor.Symmetric
- Part18.Name = "Left Leg"
- Part18.Parent = Model1
- Part18.CFrame = CFrame.new(-8.08453465, 1.00001407, 72.6154861, -0.964122772, 0, 0.265456945, 0, 1, 0, -0.265456945, 0, -0.964122772)
- Part18.Orientation = Vector3.new(0, 164.610001, 0)
- Part18.Position = Vector3.new(-8.08453465, 1.00001407, 72.6154861)
- Part18.Rotation = Vector3.new(-180, 15.3899994, -180)
- Part18.Color = Color3.new(0.156863, 0.498039, 0.278431)
- Part18.Size = Vector3.new(1, 2, 1)
- Part18.BottomSurface = Enum.SurfaceType.Smooth
- Part18.BrickColor = BrickColor.new("Dark green")
- Part18.CanCollide = false
- Part18.brickColor = BrickColor.new("Dark green")
- Part18.FormFactor = Enum.FormFactor.Symmetric
- Part18.formFactor = Enum.FormFactor.Symmetric
- Part19.Name = "Right Leg"
- Part19.Parent = Model1
- Part19.CFrame = CFrame.new(-9.04865742, 1.00001407, 72.350029, -0.964122772, 0, 0.265456945, 0, 1, 0, -0.265456945, 0, -0.964122772)
- Part19.Orientation = Vector3.new(0, 164.610001, 0)
- Part19.Position = Vector3.new(-9.04865742, 1.00001407, 72.350029)
- Part19.Rotation = Vector3.new(-180, 15.3899994, -180)
- Part19.Color = Color3.new(0.156863, 0.498039, 0.278431)
- Part19.Size = Vector3.new(1, 2, 1)
- Part19.BottomSurface = Enum.SurfaceType.Smooth
- Part19.BrickColor = BrickColor.new("Dark green")
- Part19.CanCollide = false
- Part19.brickColor = BrickColor.new("Dark green")
- Part19.FormFactor = Enum.FormFactor.Symmetric
- Part19.formFactor = Enum.FormFactor.Symmetric
- Humanoid20.Parent = Model1
- Humanoid20.LeftLeg = Part18
- Humanoid20.RightLeg = Part19
- Humanoid20.Torso = Part21
- Part21.Name = "HumanoidRootPart"
- Part21.Parent = Model1
- Part21.CFrame = CFrame.new(-8.56659603, 3.00001407, 72.4827576, -0.964122772, 0, 0.265456945, 0, 1, 0, -0.265456945, 0, -0.964122772)
- Part21.Orientation = Vector3.new(0, 164.610001, 0)
- Part21.Position = Vector3.new(-8.56659603, 3.00001407, 72.4827576)
- Part21.Rotation = Vector3.new(-180, 15.3899994, -180)
- Part21.Color = Color3.new(0.0509804, 0.411765, 0.67451)
- Part21.Transparency = 1
- Part21.Size = Vector3.new(2, 2, 1)
- Part21.BottomSurface = Enum.SurfaceType.Smooth
- Part21.BrickColor = BrickColor.new("Bright blue")
- Part21.CanCollide = false
- Part21.LeftParamA = 0
- Part21.LeftParamB = 0
- Part21.RightParamA = 0
- Part21.RightParamB = 0
- Part21.TopSurface = Enum.SurfaceType.Smooth
- Part21.brickColor = BrickColor.new("Bright blue")
- Part21.FormFactor = Enum.FormFactor.Symmetric
- Part21.formFactor = Enum.FormFactor.Symmetric
- Motor6D22.Name = "RootJoint"
- Motor6D22.Parent = Part21
- Motor6D22.MaxVelocity = 0.10000000149012
- Motor6D22.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D22.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D22.Part0 = Part21
- Motor6D22.Part1 = Part9
- Motor6D22.part1 = Part9
- Script23.Name = "Sound"
- Script23.Parent = Model1
- table.insert(cors,sandbox(Script23,function()
- ---This server script creates the sounds and also exists so that it can be easily copied into an NPC and create sounds for that NPC.
- --Remove the local script if you copy this into an NPC.
- --humanoidSoundNewLocal.rbxmx--
- function newSound(name, id)
- local sound = Instance.new("Sound")
- sound.SoundId = id
- sound.Name = name
- sound.archivable = false
- sound.Parent = script.Parent.Head
- return sound
- end
- -- declarations
- local sGettingUp = newSound("GettingUp", "rbxasset://sounds/action_get_up.mp3")
- local sDied = newSound("Died", "rbxasset://sounds/uuhhh.mp3")
- local sFreeFalling = newSound("FreeFalling", "rbxasset://sounds/action_falling.mp3")
- local sJumping = newSound("Jumping", "rbxasset://sounds/action_jump.mp3")
- local sLanding = newSound("Landing", "rbxasset://sounds/action_jump_land.mp3")
- local sSplash = newSound("Splash", "rbxasset://sounds/impact_water.mp3")
- local sRunning = newSound("Running", "rbxasset://sounds/action_footsteps_plastic.mp3")
- sRunning.Looped = true
- local sSwimming = newSound("Swimming", "rbxasset://sounds/action_swim.mp3")
- sSwimming.Looped = true
- local sClimbing = newSound("Climbing", "rbxasset://sounds/action_footsteps_plastic.mp3")
- sClimbing.Looped = true
- end))
- LocalScript24.Name = "LocalSound"
- LocalScript24.Parent = Script23
- table.insert(cors,sandbox(LocalScript24,function()
- --This local script will run only for the player whos character it is in. It's changes to the sounds will replicate as they are changes to the character.
- -- util
- function waitForChild(parent, childName)
- local child = parent:findFirstChild(childName)
- if child then return child end
- while true do
- child = parent.ChildAdded:wait()
- if child.Name==childName then return child end
- end
- end
- -- declarations
- local Figure = script.Parent.Parent
- local Head = waitForChild(Figure, "Head")
- local Humanoid = waitForChild(Figure, "Humanoid")
- local sGettingUp = waitForChild(Head, "GettingUp")
- local sDied = waitForChild(Head, "Died")
- local sFreeFalling = waitForChild(Head, "FreeFalling")
- local sJumping = waitForChild(Head, "Jumping")
- local sLanding = waitForChild(Head, "Landing")
- local sSplash = waitForChild(Head, "Splash")
- local sRunning = waitForChild(Head, "Running")
- sRunning.Looped = true
- local sSwimming = waitForChild(Head, "Swimming")
- sSwimming.Looped = true
- local sClimbing =waitForChild(Head, "Climbing")
- sClimbing.Looped = true
- local prevState = "None"
- -- functions
- function onDied()
- stopLoopedSounds()
- sDied:Play()
- end
- local fallCount = 0
- local fallSpeed = 0
- function onStateFall(state, sound)
- fallCount = fallCount + 1
- if state then
- sound.Volume = 0
- sound:Play()
- Spawn( function()
- local t = 0
- local thisFall = fallCount
- while t < 1.5 and fallCount == thisFall do
- local vol = math.max(t - 0.3 , 0)
- sound.Volume = vol
- wait(0.1)
- t = t + 0.1
- end
- end)
- else
- sound:Stop()
- end
- fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y))
- end
- function onStateNoStop(state, sound)
- if state then
- sound:Play()
- end
- end
- function onRunning(speed)
- sClimbing:Stop()
- sSwimming:Stop()
- if (prevState == "FreeFall" and fallSpeed > 0.1) then
- local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
- sLanding.Volume = vol
- sLanding:Play()
- fallSpeed = 0
- end
- if speed>0.5 then
- sRunning:Resume()
- sRunning.Pitch = speed / 8.0
- else
- sRunning:Pause()
- end
- prevState = "Run"
- end
- function onSwimming(speed)
- if (prevState ~= "Swim" and speed > 0.1) then
- local volume = math.min(1.0, speed / 350)
- sSplash.Volume = volume
- sSplash:Play()
- prevState = "Swim"
- end
- sClimbing:Stop()
- sRunning:Stop()
- sSwimming.Pitch = 1.6
- sSwimming:Resume()
- end
- function onClimbing(speed)
- sRunning:Stop()
- sSwimming:Stop()
- if speed>0.01 then
- sClimbing:Resume()
- sClimbing.Pitch = speed / 5.5
- else
- sClimbing:Pause()
- end
- prevState = "Climb"
- end
- -- connect up
- function stopLoopedSounds()
- sRunning:Stop()
- sClimbing:Stop()
- sSwimming:Stop()
- end
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Swimming:connect(onSwimming)
- Humanoid.Climbing:connect(onClimbing)
- Humanoid.Jumping:connect(function(state) onStateNoStop(state, sJumping) prevState = "Jump" end)
- Humanoid.GettingUp:connect(function(state) stopLoopedSounds() onStateNoStop(state, sGettingUp) prevState = "GetUp" end)
- Humanoid.FreeFalling:connect(function(state) stopLoopedSounds() onStateFall(state, sFreeFalling) prevState = "FreeFall" end)
- Humanoid.FallingDown:connect(function(state) stopLoopedSounds() end)
- Humanoid.StateChanged:connect(function(old, new)
- if not (new.Name == "Dead" or
- new.Name == "Running" or
- new.Name == "RunningNoPhysics" or
- new.Name == "Swimming" or
- new.Name == "Jumping" or
- new.Name == "GettingUp" or
- new.Name == "Freefall" or
- new.Name == "FallingDown") then
- stopLoopedSounds()
- end
- end)
- end))
- Script25.Name = "Health"
- Script25.Parent = Model1
- table.insert(cors,sandbox(Script25,function()
- --Responsible for regening a player's humanoid's health
- -- declarations
- local Figure = script.Parent
- local Head = Figure:WaitForChild("Head")
- local Humanoid = Figure:WaitForChild("Humanoid")
- 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))
- BodyColors26.Parent = Model1
- BodyColors26.HeadColor = BrickColor.new("Bright yellow")
- BodyColors26.HeadColor3 = Color3.new(0.960784, 0.803922, 0.188235)
- BodyColors26.LeftArmColor = BrickColor.new("Bright yellow")
- BodyColors26.LeftArmColor3 = Color3.new(0.960784, 0.803922, 0.188235)
- BodyColors26.LeftLegColor = BrickColor.new("Dark green")
- BodyColors26.LeftLegColor3 = Color3.new(0.156863, 0.498039, 0.278431)
- BodyColors26.RightArmColor = BrickColor.new("Bright yellow")
- BodyColors26.RightArmColor3 = Color3.new(0.960784, 0.803922, 0.188235)
- BodyColors26.RightLegColor = BrickColor.new("Dark green")
- BodyColors26.RightLegColor3 = Color3.new(0.156863, 0.498039, 0.278431)
- BodyColors26.TorsoColor = BrickColor.new("Bright blue")
- BodyColors26.TorsoColor3 = Color3.new(0.0509804, 0.411765, 0.67451)
- ShirtGraphic27.Parent = Model1
- ShirtGraphic27.Graphic = "http://www.roblox.com/asset/?id=236928940"
- Script28.Name = "RandomChat"
- Script28.Parent = Model1
- table.insert(cors,sandbox(Script28,function()
- while true do
- e = (math.random(1, 7))
- if e == 1 then
- game:GetService("Chat"):Chat(script.Parent.Head, "Hi :3", Enum.ChatColor.Blue)
- wait(2)
- end
- if e == 2 then
- game:GetService("Chat"):Chat(script.Parent.Head, "Wanna be friends?", Enum.ChatColor.Blue)
- wait(2)
- end
- if e == 3 then
- game:GetService("Chat"):Chat(script.Parent.Head, "BUILDERMAN IS MY DAD", Enum.ChatColor.Blue)
- wait(2)
- end
- if e == 4 then
- game:GetService("Chat"):Chat(script.Parent.Head, "0M6 1'M R3P0R71NG Y0U!!111!!", Enum.ChatColor.Blue)
- wait(2)
- end
- if e == 5 then
- game:GetService("Chat"):Chat(script.Parent.Head, "TEH EPIK DUCK IS COMING", Enum.ChatColor.Blue)
- wait(2)
- end
- if e == 6 then
- game:GetService("Chat"):Chat(script.Parent.Head, "Yes", Enum.ChatColor.Blue)
- wait(2)
- if e == 7 then
- game:GetService("Chat"):Chat(script.Parent.Head, "ALL YOUR BASES ARE BELONG TO ME", Enum.ChatColor.Blue)
- wait(2)
- end
- end
- end
- end))
- Script29.Name = "Follow"
- Script29.Parent = Model1
- table.insert(cors,sandbox(Script29,function()
- local larm = script.Parent:FindFirstChild("Left Arm")
- local rarm = script.Parent:FindFirstChild("Right Arm")
- function findNearestTorso(pos)
- local list = game.Workspace:children()
- local torso = nil
- local dist = 50
- 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("Torso")
- 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(0.1)
- local target = findNearestTorso(script.Parent.Torso.Position)
- if target ~= nil then--
- script.Parent.Humanoid:MoveTo(target.Position, target)
- end
- end
- end))
- Script30.Name = "Animate"
- Script30.Parent = Model1
- table.insert(cors,sandbox(Script30,function()
- function waitForChild(parent, childName)
- local child = parent:findFirstChild(childName)
- if child then return child end
- while true do
- child = parent.ChildAdded:wait()
- if child.Name==childName then return child end
- end
- end
- local Figure = script.Parent
- local Torso = waitForChild(Figure, "Torso")
- local RightShoulder = waitForChild(Torso, "Right Shoulder")
- local LeftShoulder = waitForChild(Torso, "Left Shoulder")
- local RightHip = waitForChild(Torso, "Right Hip")
- local LeftHip = waitForChild(Torso, "Left Hip")
- local Neck = waitForChild(Torso, "Neck")
- local Humanoid = waitForChild(Figure, "Humanoid")
- local pose = "Standing"
- local currentAnim = ""
- local currentAnimTrack = nil
- local currentAnimKeyframeHandler = nil
- local currentAnimSpeed = 1.0
- local animTable = {}
- local animNames = {
- idle = {
- { id = "http://www.roblox.com/asset/?id=125750544", weight = 9 },
- { id = "http://www.roblox.com/asset/?id=125750618", weight = 1 }
- },
- walk = {
- { id = "http://www.roblox.com/asset/?id=125749145", weight = 10 }
- },
- run = {
- { id = "run.xml", weight = 10 }
- },
- jump = {
- { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
- },
- fall = {
- { id = "http://www.roblox.com/asset/?id=125750759", weight = 10 }
- },
- climb = {
- { id = "http://www.roblox.com/asset/?id=125750800", weight = 10 }
- },
- toolnone = {
- { id = "http://www.roblox.com/asset/?id=125750867", weight = 10 }
- },
- toolslash = {
- { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
- -- { id = "slash.xml", weight = 10 }
- },
- toollunge = {
- { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
- },
- wave = {
- { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
- },
- point = {
- { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
- },
- dance = {
- { id = "http://www.roblox.com/asset/?id=130018893", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=132546839", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=132546884", weight = 10 }
- },
- dance2 = {
- { id = "http://www.roblox.com/asset/?id=160934142", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=160934298", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=160934376", weight = 10 }
- },
- dance3 = {
- { id = "http://www.roblox.com/asset/?id=160934458", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=160934530", weight = 10 },
- { id = "http://www.roblox.com/asset/?id=160934593", weight = 10 }
- },
- laugh = {
- { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
- },
- cheer = {
- { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
- },
- }
- -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
- local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
- math.randomseed(tick())
- function configureAnimationSet(name, fileList)
- if (animTable[name] ~= nil) then
- for _, connection in pairs(animTable[name].connections) do
- connection:disconnect()
- end
- end
- animTable[name] = {}
- animTable[name].count = 0
- animTable[name].totalWeight = 0
- animTable[name].connections = {}
- -- check for config values
- local config = script:FindFirstChild(name)
- if (config ~= nil) then
- -- print("Loading anims " .. name)
- table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
- table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
- local idx = 1
- for _, childPart in pairs(config:GetChildren()) do
- if (childPart:IsA("Animation")) then
- table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
- animTable[name][idx] = {}
- animTable[name][idx].anim = childPart
- local weightObject = childPart:FindFirstChild("Weight")
- if (weightObject == nil) then
- animTable[name][idx].weight = 1
- else
- animTable[name][idx].weight = weightObject.Value
- end
- animTable[name].count = animTable[name].count + 1
- animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
- -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
- idx = idx + 1
- end
- end
- end
- -- fallback to defaults
- if (animTable[name].count <= 0) then
- for idx, anim in pairs(fileList) do
- animTable[name][idx] = {}
- animTable[name][idx].anim = Instance.new("Animation")
- animTable[name][idx].anim.Name = name
- animTable[name][idx].anim.AnimationId = anim.id
- animTable[name][idx].weight = anim.weight
- animTable[name].count = animTable[name].count + 1
- animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
- -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
- end
- end
- end
- -- Setup animation objects
- function scriptChildModified(child)
- local fileList = animNames[child.Name]
- if (fileList ~= nil) then
- configureAnimationSet(child.Name, fileList)
- end
- end
- script.ChildAdded:connect(scriptChildModified)
- script.ChildRemoved:connect(scriptChildModified)
- for name, fileList in pairs(animNames) do
- configureAnimationSet(name, fileList)
- end
- -- ANIMATION
- -- declarations
- local toolAnim = "None"
- local toolAnimTime = 0
- local jumpAnimTime = 0
- local jumpAnimDuration = 0.3
- local toolTransitionTime = 0.1
- local fallTransitionTime = 0.3
- local jumpMaxLimbVelocity = 0.75
- -- functions
- function stopAllAnimations()
- local oldAnim = currentAnim
- -- return to idle if finishing an emote
- if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
- oldAnim = "idle"
- end
- currentAnim = ""
- if (currentAnimKeyframeHandler ~= nil) then
- currentAnimKeyframeHandler:disconnect()
- end
- if (currentAnimTrack ~= nil) then
- currentAnimTrack:Stop()
- currentAnimTrack:Destroy()
- currentAnimTrack = nil
- end
- return oldAnim
- end
- function setAnimationSpeed(speed)
- if speed ~= currentAnimSpeed then
- currentAnimSpeed = speed
- currentAnimTrack:AdjustSpeed(currentAnimSpeed)
- end
- end
- function keyFrameReachedFunc(frameName)
- if (frameName == "End") then
- -- print("Keyframe : ".. frameName)
- local repeatAnim = stopAllAnimations()
- local animSpeed = currentAnimSpeed
- playAnimation(repeatAnim, 0.0, Humanoid)
- setAnimationSpeed(animSpeed)
- end
- end
- -- Preload animations
- function playAnimation(animName, transitionTime, humanoid)
- local idleFromEmote = (animName == "idle" and emoteNames[currentAnim] ~= nil)
- if (animName ~= currentAnim and not idleFromEmote) then
- if (currentAnimTrack ~= nil) then
- currentAnimTrack:Stop(transitionTime)
- currentAnimTrack:Destroy()
- end
- currentAnimSpeed = 1.0
- local roll = math.random(1, animTable[animName].totalWeight)
- local origRoll = roll
- local idx = 1
- while (roll > animTable[animName][idx].weight) do
- roll = roll - animTable[animName][idx].weight
- idx = idx + 1
- end
- -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
- local anim = animTable[animName][idx].anim
- -- load it to the humanoid; get AnimationTrack
- currentAnimTrack = humanoid:LoadAnimation(anim)
- -- play the animation
- currentAnimTrack:Play(transitionTime)
- currentAnim = animName
- -- set up keyframe name triggers
- if (currentAnimKeyframeHandler ~= nil) then
- currentAnimKeyframeHandler:disconnect()
- end
- currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
- end
- end
- -------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------
- local toolAnimName = ""
- local toolAnimTrack = nil
- local currentToolAnimKeyframeHandler = nil
- function toolKeyFrameReachedFunc(frameName)
- if (frameName == "End") then
- -- print("Keyframe : ".. frameName)
- local repeatAnim = stopToolAnimations()
- playToolAnimation(repeatAnim, 0.0, Humanoid)
- end
- end
- function playToolAnimation(animName, transitionTime, humanoid)
- if (animName ~= toolAnimName) then
- if (toolAnimTrack ~= nil) then
- toolAnimTrack:Stop()
- toolAnimTrack:Destroy()
- transitionTime = 0
- end
- local roll = math.random(1, animTable[animName].totalWeight)
- local origRoll = roll
- local idx = 1
- while (roll > animTable[animName][idx].weight) do
- roll = roll - animTable[animName][idx].weight
- idx = idx + 1
- end
- -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
- local anim = animTable[animName][idx].anim
- -- load it to the humanoid; get AnimationTrack
- toolAnimTrack = humanoid:LoadAnimation(anim)
- -- play the animation
- toolAnimTrack:Play(transitionTime)
- toolAnimName = animName
- currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
- end
- end
- function stopToolAnimations()
- local oldAnim = toolAnimName
- if (currentToolAnimKeyframeHandler ~= nil) then
- currentToolAnimKeyframeHandler:disconnect()
- end
- toolAnimName = ""
- if (toolAnimTrack ~= nil) then
- toolAnimTrack:Stop()
- toolAnimTrack:Destroy()
- toolAnimTrack = nil
- end
- return oldAnim
- end
- -------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------
- function onRunning(speed)
- if speed>0.01 then
- playAnimation("walk", 0.1, Humanoid)
- pose = "Running"
- else
- playAnimation("idle", 0.1, Humanoid)
- pose = "Standing"
- end
- end
- function onDied()
- pose = "Dead"
- end
- function onJumping()
- playAnimation("jump", 0.1, Humanoid)
- jumpAnimTime = jumpAnimDuration
- pose = "Jumping"
- end
- function onClimbing(speed)
- playAnimation("climb", 0.1, Humanoid)
- setAnimationSpeed(speed / 12.0)
- pose = "Climbing"
- end
- function onGettingUp()
- pose = "GettingUp"
- end
- function onFreeFall()
- if (jumpAnimTime <= 0) then
- playAnimation("fall", fallTransitionTime, Humanoid)
- end
- pose = "FreeFall"
- end
- function onFallingDown()
- pose = "FallingDown"
- end
- function onSeated()
- pose = "Seated"
- end
- function onPlatformStanding()
- pose = "PlatformStanding"
- end
- function onSwimming(speed)
- if speed>0 then
- pose = "Running"
- else
- pose = "Standing"
- end
- end
- function getTool()
- for _, kid in ipairs(Figure:GetChildren()) do
- if kid.className == "Tool" then return kid end
- end
- return nil
- end
- function getToolAnim(tool)
- for _, c in ipairs(tool:GetChildren()) do
- if c.Name == "toolanim" and c.className == "StringValue" then
- return c
- end
- end
- return nil
- end
- function animateTool()
- if (toolAnim == "None") then
- playToolAnimation("toolnone", toolTransitionTime, Humanoid)
- return
- end
- if (toolAnim == "Slash") then
- playToolAnimation("toolslash", 0, Humanoid)
- return
- end
- if (toolAnim == "Lunge") then
- playToolAnimation("toollunge", 0, Humanoid)
- return
- end
- end
- function moveSit()
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- RightShoulder:SetDesiredAngle(3.14 /2)
- LeftShoulder:SetDesiredAngle(-3.14 /2)
- RightHip:SetDesiredAngle(3.14 /2)
- LeftHip:SetDesiredAngle(-3.14 /2)
- end
- local lastTick = 0
- function move(time)
- local amplitude = 1
- local frequency = 1
- local deltaTime = time - lastTick
- lastTick = time
- local climbFudge = 0
- local setAngles = false
- if (jumpAnimTime > 0) then
- jumpAnimTime = jumpAnimTime - deltaTime
- end
- if (pose == "FreeFall" and jumpAnimTime <= 0) then
- playAnimation("fall", fallTransitionTime, Humanoid)
- elseif (pose == "Seated") then
- stopAllAnimations()
- moveSit()
- return
- elseif (pose == "Running") then
- playAnimation("walk", 0.1, Humanoid)
- elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
- -- print("Wha " .. pose)
- amplitude = 0.1
- frequency = 1
- setAngles = true
- end
- if (setAngles) then
- desiredAngle = amplitude * math.sin(time * frequency)
- RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
- LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
- RightHip:SetDesiredAngle(-desiredAngle)
- LeftHip:SetDesiredAngle(-desiredAngle)
- end
- -- Tool Animation handling
- local tool = getTool()
- if tool then
- animStringValueObject = getToolAnim(tool)
- if animStringValueObject then
- toolAnim = animStringValueObject.Value
- -- message recieved, delete StringValue
- animStringValueObject.Parent = nil
- toolAnimTime = time + .3
- end
- if time > toolAnimTime then
- toolAnimTime = 0
- toolAnim = "None"
- end
- animateTool()
- else
- stopToolAnimations()
- toolAnim = "None"
- toolAnimTime = 0
- end
- end
- -- connect events
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Jumping:connect(onJumping)
- Humanoid.Climbing:connect(onClimbing)
- Humanoid.GettingUp:connect(onGettingUp)
- Humanoid.FreeFalling:connect(onFreeFall)
- Humanoid.FallingDown:connect(onFallingDown)
- Humanoid.Seated:connect(onSeated)
- Humanoid.PlatformStanding:connect(onPlatformStanding)
- Humanoid.Swimming:connect(onSwimming)
- -- main program
- local runService = game:service("RunService");
- -- initialize to idle
- playAnimation("idle", 0.1, Humanoid)
- pose = "Standing"
- while Figure.Parent~=nil do
- local _, time = wait(0.1)
- move(time)
- end
- end))
- StringValue31.Name = "climb"
- StringValue31.Parent = Script30
- Animation32.Name = "ClimbAnim"
- Animation32.Parent = StringValue31
- Animation32.AnimationId = "http://www.roblox.com/asset/?id=125750800"
- StringValue33.Name = "fall"
- StringValue33.Parent = Script30
- Animation34.Name = "FallAnim"
- Animation34.Parent = StringValue33
- Animation34.AnimationId = "http://www.roblox.com/asset/?id=125750759"
- StringValue35.Name = "idle"
- StringValue35.Parent = Script30
- Animation36.Name = "Animation1"
- Animation36.Parent = StringValue35
- Animation36.AnimationId = "http://www.roblox.com/asset/?id=125750544"
- NumberValue37.Name = "Weight"
- NumberValue37.Parent = Animation36
- NumberValue37.Value = 9
- Animation38.Name = "Animation2"
- Animation38.Parent = StringValue35
- Animation38.AnimationId = "http://www.roblox.com/asset/?id=125750618"
- NumberValue39.Name = "Weight"
- NumberValue39.Parent = Animation38
- NumberValue39.Value = 1
- StringValue40.Name = "jump"
- StringValue40.Parent = Script30
- Animation41.Name = "JumpAnim"
- Animation41.Parent = StringValue40
- Animation41.AnimationId = "http://www.roblox.com/asset/?id=125750702"
- StringValue42.Name = "run"
- StringValue42.Parent = Script30
- Animation43.Name = "RunAnim"
- Animation43.Parent = StringValue42
- Animation43.AnimationId = "http://www.roblox.com/asset/?id=125749145"
- StringValue44.Name = "toolnone"
- StringValue44.Parent = Script30
- Animation45.Name = "ToolNoneAnim"
- Animation45.Parent = StringValue44
- Animation45.AnimationId = "http://www.roblox.com/asset/?id=125750867"
- StringValue46.Name = "walk"
- StringValue46.Parent = Script30
- Animation47.Name = "WalkAnim"
- Animation47.Parent = StringValue46
- Animation47.AnimationId = "http://www.roblox.com/asset/?id=125749145"
- Script48.Name = "Chat"
- Script48.Parent = Model1
- table.insert(cors,sandbox(Script48,function()
- while true do
- game:GetService("Chat"):Chat(script.Parent.Head, "Hi :3", Enum.ChatColor.Blue)
- wait(3)
- game:GetService("Chat"):Chat(script.Parent.Head, "Wanna be friends?", Enum.ChatColor.Blue)
- wait(3)
- game:GetService("Chat"):Chat(script.Parent.Head, "BUILDERMAN IS MY DAD", Enum.ChatColor.Blue)
- wait(3)
- game:GetService("Chat"):Chat(script.Parent.Head, "0M6 1'M R3P0R71NG Y0U!!111!!", Enum.ChatColor.Blue)
- wait(3)
- game:GetService("Chat"):Chat(script.Parent.Head, "TEH EPIK DUCK IS COMING", Enum.ChatColor.Blue)
- wait(3)
- game:GetService("Chat"):Chat(script.Parent.Head, "Yes", Enum.ChatColor.Blue)
- wait(3)
- game:GetService("Chat"):Chat(script.Parent.Head, "ALL YOUR BASES ARE BELONG TO ME", Enum.ChatColor.Blue)
- wait(3)
- end
- end))
- Script49.Name = "Respawn"
- Script49.Parent = Model1
- table.insert(cors,sandbox(Script49,function()
- name="Humanoid"
- robo=script.Parent:clone()
- while true do
- wait(1)
- if script.Parent.Humanoid.Health<1 then
- robot=robo:clone()
- robot.Parent=script.Parent.Parent
- robot:makeJoints()
- script.Parent:remove()
- end
- end
- end))
- 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