Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- creeper --
- -- left click to blow up
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do
- print("FE Compatibility code by Mokiros")
- local rp = RealPlayer
- script.Parent = rp.Character
- --RemoteEvent for communicating
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- --Fake event to make stuff like Mouse.KeyDown work
- local function fakeEvent()
- local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
- t.connect = t.Connect
- return t
- end
- --Creating fake input objects with fake variables
- local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function te(self,ev,...)
- local t = m[ev]
- if t and t._fakeEvent then
- for _,f in pairs(t.Functions) do
- f(...)
- end
- end
- end
- m.TrigEvent = te
- UIS.TrigEvent = te
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=rp then return end
- m.Target = io.Target
- m.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return m:TrigEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return m:TrigEvent(b and "Button2Down" or "Button2Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[
- local Player = game:GetService("Players").LocalPlayer
- local Event = script:WaitForChild("UserInput_Event")
- local Mouse = Player:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,a)
- if a then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data 30 times every second, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- while wait(1/30) do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- end]==],Player.Character)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local _rg = game
- --Metatable for fake service
- local fsmt = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then
- return typeof(s[k])=="function"
- and function(_,...)return s[k](s,...)end or s[k]
- end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
- return setmetatable(t,fsmt)
- end
- --Fake game object
- local g = {
- GetService = function(self,s)
- return rawget(self,s) or _rg:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = _rg:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- }
- rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
- g.service = g.GetService
- FakeService(g,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = g,g.Players.LocalPlayer
- end
- NLS([[warn(left click to blow up)]],owner.Character)
- creeper = game.Players.LocalPlayer
- awman = creeper.Character
- Model0 = awman
- Part1 = Model0["Right Arm"]
- Decal2 = Instance.new("Decal")
- Texture3 = Instance.new("Texture")
- Texture4 = Instance.new("Texture")
- Texture5 = Instance.new("Texture")
- Texture6 = Instance.new("Texture")
- Texture7 = Instance.new("Texture")
- Part8 = Model0["Left Arm"]
- Decal9 = Instance.new("Decal")
- Texture10 = Instance.new("Texture")
- Texture11 = Instance.new("Texture")
- Texture12 = Instance.new("Texture")
- Texture13 = Instance.new("Texture")
- Texture14 = Instance.new("Texture")
- Part15 = Model0["Right Leg"]
- Decal16 = Instance.new("Decal")
- Texture17 = Instance.new("Texture")
- Texture18 = Instance.new("Texture")
- Texture19 = Instance.new("Texture")
- Texture20 = Instance.new("Texture")
- Texture21 = Instance.new("Texture")
- Part22 = Model0["Left Leg"]
- Decal23 = Instance.new("Decal")
- Texture24 = Instance.new("Texture")
- Texture25 = Instance.new("Texture")
- Texture26 = Instance.new("Texture")
- Texture27 = Instance.new("Texture")
- Texture28 = Instance.new("Texture")
- Part29 = Model0.Torso
- Sound30 = Instance.new("Sound")
- Weld31 = Instance.new("Weld")
- Texture32 = Instance.new("Texture")
- Texture33 = Instance.new("Texture")
- Texture34 = Instance.new("Texture")
- Texture35 = Instance.new("Texture")
- Texture36 = Instance.new("Texture")
- Texture37 = Instance.new("Texture")
- Part38 = Model0.Head
- Part38:ClearAllChildren()
- Texture39 = Instance.new("Texture")
- Texture40 = Instance.new("Texture")
- Texture41 = Instance.new("Texture")
- Texture42 = Instance.new("Texture")
- Texture43 = Instance.new("Texture")
- Texture44 = Instance.new("Texture")
- local pos = Model0.HumanoidRootPart.CFrame
- Part45 = Instance.new("Part")
- Decal46 = Instance.new("Decal")
- Weld47 = Instance.new("Weld")
- SpecialMesh48 = Instance.new("SpecialMesh")
- Humanoid49 = Model0.Humanoid
- Part1.Name = "Right Arm"
- Part1.Parent = Model0
- Part1.CFrame = CFrame.new(1345.75, 1164.79016, -34.9391785, -1, 0, -0, -0, 1, -0, -0, 0, -1)
- Part1.Orientation = Vector3.new(0, -180, 0)
- Part1.Position = Vector3.new(1345.75, 1164.79016, -34.9391785)
- Part1.Rotation = Vector3.new(180, 0, -180)
- Part1.Color = Color3.new(0.227451, 0.490196, 0.0823529)
- Part1.Size = Vector3.new(1, 1, 1)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.BrickColor = BrickColor.new("Camo")
- Part1.Material = Enum.Material.Ice
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("Camo")
- Decal2.Name = "Creeper foot"
- Decal2.Parent = Part1
- Decal2.Texture = "http://www.roblox.com/asset/?id=84358512"
- Texture3.Parent = Part1
- Texture3.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture3.Face = Enum.NormalId.Back
- Texture4.Parent = Part1
- Texture4.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture4.Face = Enum.NormalId.Top
- Texture5.Parent = Part1
- Texture5.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture5.Face = Enum.NormalId.Bottom
- Texture6.Parent = Part1
- Texture6.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture6.Face = Enum.NormalId.Right
- Texture7.Parent = Part1
- Texture7.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture7.Face = Enum.NormalId.Left
- Part8.Name = "Left Arm"
- Part8.Parent = Model0
- Part8.CFrame = CFrame.new(1346.75, 1164.79016, -34.9391785, -1, 0, -0, -0, 1, -0, -0, 0, -1)
- Part8.Orientation = Vector3.new(0, -180, 0)
- Part8.Position = Vector3.new(1346.75, 1164.79016, -34.9391785)
- Part8.Rotation = Vector3.new(180, 0, -180)
- Part8.Color = Color3.new(0.227451, 0.490196, 0.0823529)
- Part8.Size = Vector3.new(1, 1, 1)
- Part8.BottomSurface = Enum.SurfaceType.Smooth
- Part8.BrickColor = BrickColor.new("Camo")
- Part8.Material = Enum.Material.Ice
- Part8.TopSurface = Enum.SurfaceType.Smooth
- Part8.brickColor = BrickColor.new("Camo")
- Decal9.Name = "Creeper foot"
- Decal9.Parent = Part8
- Decal9.Texture = "http://www.roblox.com/asset/?id=84358512"
- Texture10.Parent = Part8
- Texture10.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture10.Face = Enum.NormalId.Bottom
- Texture11.Parent = Part8
- Texture11.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture11.Face = Enum.NormalId.Top
- Texture12.Parent = Part8
- Texture12.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture12.Face = Enum.NormalId.Back
- Texture13.Parent = Part8
- Texture13.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture13.Face = Enum.NormalId.Right
- Texture14.Parent = Part8
- Texture14.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture14.Face = Enum.NormalId.Left
- Part15.Name = "Right Leg"
- Part15.Parent = Model0
- Part15.CFrame = CFrame.new(1345.75, 1164.79016, -36.9391785, -1, 0, -0, -0, 1, -0, -0, 0, -1)
- Part15.Orientation = Vector3.new(0, -180, 0)
- Part15.Position = Vector3.new(1345.75, 1164.79016, -36.9391785)
- Part15.Rotation = Vector3.new(180, 0, -180)
- Part15.Color = Color3.new(0.227451, 0.490196, 0.0823529)
- Part15.Size = Vector3.new(1, 1, 1)
- Part15.BottomSurface = Enum.SurfaceType.Smooth
- Part15.BrickColor = BrickColor.new("Camo")
- Part15.Material = Enum.Material.Ice
- Part15.TopSurface = Enum.SurfaceType.Smooth
- Part15.brickColor = BrickColor.new("Camo")
- Decal16.Name = "Creeper foot"
- Decal16.Parent = Part15
- Decal16.Texture = "http://www.roblox.com/asset/?id=84358512"
- Texture17.Parent = Part15
- Texture17.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture17.Face = Enum.NormalId.Bottom
- Texture18.Parent = Part15
- Texture18.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture18.Face = Enum.NormalId.Top
- Texture19.Parent = Part15
- Texture19.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture19.Face = Enum.NormalId.Back
- Texture20.Parent = Part15
- Texture20.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture20.Face = Enum.NormalId.Right
- Texture21.Parent = Part15
- Texture21.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture21.Face = Enum.NormalId.Left
- Part22.Name = "Left Leg"
- Part22.Parent = Model0
- Part22.CFrame = CFrame.new(1346.75, 1164.79016, -36.9391785, -1, 0, -0, -0, 1, -0, -0, 0, -1)
- Part22.Orientation = Vector3.new(0, -180, 0)
- Part22.Position = Vector3.new(1346.75, 1164.79016, -36.9391785)
- Part22.Rotation = Vector3.new(180, 0, -180)
- Part22.Color = Color3.new(0.227451, 0.490196, 0.0823529)
- Part22.Size = Vector3.new(1, 1, 1)
- Part22.BottomSurface = Enum.SurfaceType.Smooth
- Part22.BrickColor = BrickColor.new("Camo")
- Part22.Material = Enum.Material.Ice
- Part22.TopSurface = Enum.SurfaceType.Smooth
- Part22.brickColor = BrickColor.new("Camo")
- Decal23.Name = "Creeper foot"
- Decal23.Parent = Part22
- Decal23.Texture = "http://www.roblox.com/asset/?id=84358512"
- Texture24.Parent = Part22
- Texture24.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture24.Face = Enum.NormalId.Bottom
- Texture25.Parent = Part22
- Texture25.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture25.Face = Enum.NormalId.Top
- Texture26.Parent = Part22
- Texture26.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture26.Face = Enum.NormalId.Back
- Texture27.Parent = Part22
- Texture27.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture27.Face = Enum.NormalId.Right
- Texture28.Parent = Part22
- Texture28.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture28.Face = Enum.NormalId.Left
- Part29.Name = "Torso"
- Part29.Parent = Model0
- Part29.CFrame = CFrame.new(1346.25, 1166.79016, -35.9391785, -1, 0, 0, 0, 1, 0, 0, 0, -1)
- Part29.Orientation = Vector3.new(0, 180, 0)
- Part29.Position = Vector3.new(1346.25, 1166.79016, -35.9391785)
- Part29.Rotation = Vector3.new(-180, 0, -180)
- Part29.Color = Color3.new(0.227451, 0.490196, 0.0823529)
- Part29.Size = Vector3.new(2, 3, 1)
- Part29.BottomSurface = Enum.SurfaceType.Smooth
- Part29.BrickColor = BrickColor.new("Camo")
- Part29.Material = Enum.Material.Ice
- Part29.TopSurface = Enum.SurfaceType.Weld
- Part29.brickColor = BrickColor.new("Camo")
- Sound30.Name = "Sizzle"
- Sound30.Parent = Part29
- Sound30.Pitch = 2
- Sound30.PlaybackSpeed = 2
- Sound30.SoundId = "http://www.roblox.com/asset/?id=1369158"
- Sound30.Volume = 1
- Weld31.Parent = Part29
- Weld31.C0 = CFrame.new(0, 1.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
- Weld31.C1 = CFrame.new(0, -1, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
- Weld31.Part0 = Part29
- Weld31.Part1 = Part38
- Weld31.part1 = Part38
- Texture32.Parent = Part29
- Texture32.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture32.Face = Enum.NormalId.Right
- Texture33.Parent = Part29
- Texture33.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture33.Face = Enum.NormalId.Left
- Texture34.Parent = Part29
- Texture34.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture35.Parent = Part29
- Texture35.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture35.Face = Enum.NormalId.Back
- Texture36.Parent = Part29
- Texture36.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture36.Face = Enum.NormalId.Top
- Texture37.Parent = Part29
- Texture37.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture37.Face = Enum.NormalId.Bottom
- Part38.Name = "Head"
- Part38.Parent = Model0
- Part38.CFrame = CFrame.new(1346.25, 1169.29016, -35.9391785, -1, 0, 0, 0, 1, 0, 0, 0, -1)
- Part38.Orientation = Vector3.new(0, 180, 0)
- Part38.Position = Vector3.new(1346.25, 1169.29016, -35.9391785)
- Part38.Rotation = Vector3.new(-180, 0, -180)
- Part38.Color = Color3.new(0.227451, 0.490196, 0.0823529)
- Part38.Size = Vector3.new(2, 2, 2)
- Part38.BottomSurface = Enum.SurfaceType.Smooth
- Part38.BrickColor = BrickColor.new("Camo")
- Part38.Material = Enum.Material.Ice
- Part38.TopSurface = Enum.SurfaceType.Smooth
- Part38.brickColor = BrickColor.new("Camo")
- Texture39.Parent = Part38
- Texture39.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture39.Face = Enum.NormalId.Right
- Texture40.Parent = Part38
- Texture40.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture40.Face = Enum.NormalId.Left
- Texture41.Parent = Part38
- Texture41.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture42.Parent = Part38
- Texture42.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture42.Face = Enum.NormalId.Back
- Texture43.Parent = Part38
- Texture43.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture43.Face = Enum.NormalId.Top
- Texture44.Parent = Part38
- Texture44.Texture = "http://www.roblox.com/asset/?id=39643864"
- Texture44.Face = Enum.NormalId.Bottom
- Part45.Name = "face"
- Part45.Parent = Part38
- Part45.CFrame = CFrame.new(1346.25, 1169.29016, -35.9391785, -1, 0, 0, 0, 1, 0, 0, 0, -1)
- Part45.Orientation = Vector3.new(0, 180, 0)
- Part45.Position = Vector3.new(1346.25, 1169.29016, -35.9391785)
- Part45.Rotation = Vector3.new(-180, 0, -180)
- Part45.Color = Color3.new(0.227451, 0.490196, 0.0823529)
- Part45.Transparency = 1
- Part45.Size = Vector3.new(2, 2, 2)
- Part45.BottomSurface = Enum.SurfaceType.Smooth
- Part45.BrickColor = BrickColor.new("Camo")
- Part45.Material = Enum.Material.Ice
- Part45.TopSurface = Enum.SurfaceType.Smooth
- Part45.brickColor = BrickColor.new("Camo")
- Decal46.Parent = Part45
- Decal46.Texture = "http://www.roblox.com/asset/?id=50018586"
- Weld47.Parent = Part45
- Weld47.Part0 = Part38
- Weld47.Part1 = Part45
- Weld47.part1 = Part45
- SpecialMesh48.Parent = Part45
- SpecialMesh48.Offset = Vector3.new(0, 0, -0.00100000005)
- SpecialMesh48.MeshType = Enum.MeshType.Brick
- Humanoid49.Parent = Model0
- Humanoid49.LeftLeg = Part22
- Humanoid49.RightLeg = Part15
- Humanoid49.Torso = Part29
- Humanoid49.WalkSpeed = 12
- Humanoid49.HipHeight = 0.501
- awman:WaitForChild("Body Colors").HeadColor = BrickColor.new("White")
- awman:WaitForChild("Body Colors").TorsoColor = BrickColor.new("White")
- awman:WaitForChild("Body Colors").LeftArmColor = BrickColor.new("White")
- awman:WaitForChild("Body Colors").RightArmColor = BrickColor.new("White")
- awman:WaitForChild("Body Colors").LeftLegColor = BrickColor.new("White")
- awman:WaitForChild("Body Colors").RightLegColor = BrickColor.new("White")
- function flashon()
- for i,v in pairs(awman:GetChildren()) do
- for i,v in pairs(v:GetChildren()) do
- if v.ClassName == "Texture" or v.ClassName == "Decal" and v.Texture ~= "http://www.roblox.com/asset/?id=50018586" then
- v.Transparency = 1
- end
- end
- end
- end
- function flashoff()
- for i,v in pairs(awman:GetChildren()) do
- for i,v in pairs(v:GetChildren()) do
- if v.ClassName == "Texture" or v.ClassName == "Decal" and v.Texture ~= "http://www.roblox.com/asset/?id=50018586" then
- v.Transparency = 0
- end
- end
- end
- end
- for i,v in pairs(awman:GetChildren()) do
- if v.ClassName == "Shirt" or v.ClassName == "Pants" or v.ClassName == "ShirtGraphic" or v.ClassName == "CharacterMesh" then
- v:Destroy()
- end
- end
- for i,v in pairs(awman:GetChildren()) do
- if v.ClassName == "Part" then
- v.BrickColor = BrickColor.new("White")
- end
- end
- urdead = false
- local ticke = 0.8
- function blowup()
- flashon()
- wait(ticke)
- flashoff()
- ticke = ticke - 0.2
- wait(ticke)
- flashon()
- wait(ticke)
- flashoff()
- ticke = ticke - 0.2
- wait(ticke)
- flashon()
- wait(ticke)
- flashoff()
- ticke = ticke - 0.2
- wait(ticke)
- flashon()
- wait(ticke)
- ticke = ticke - 0.2
- flashon()
- wait(ticke)
- flashoff()
- ticke = ticke - 0.2
- wait(ticke)
- flashon()
- wait(ticke)
- flashoff()
- ticke = ticke - 0.2
- wait(ticke)
- flashon()
- wait(ticke)
- flashoff()
- ticke = ticke - 0.2
- wait(ticke)
- flashon()
- wait(ticke)
- ticke = ticke - 0.2
- flashon()
- wait(ticke)
- flashoff()
- ticke = ticke - 0.2
- wait(ticke)
- flashon()
- wait(ticke)
- flashoff()
- ticke = ticke - 0.2
- wait(ticke)
- flashon()
- wait(ticke)
- flashoff()
- ticke = ticke - 0.2
- wait(ticke)
- flashon()
- wait(ticke)
- coroutine.resume(coroutine.create(function()
- while wait() do
- for i,v in pairs(awman:GetChildren()) do
- if v.ClassName == "Part" then
- v.Size = v.Size + Vector3.new(0.005,0.005,0.005)
- end
- end
- end
- end))
- ticke = ticke - 0.2
- wait(ticke)
- ticke = ticke - 0.2
- wait(0.5)
- kabooyah = Instance.new("Explosion",workspace)
- kabooyah.Position = awman.HumanoidRootPart.Position
- kabooyah.BlastPressure = 25000
- kabooyah.BlastRadius = 25
- kabooyah.Hit:Connect(function(part)
- part.Anchored = false
- part:BreakJoints()
- end)
- for i,v in pairs(awman:GetChildren()) do
- if v.ClassName == "Part" then
- v:Destroy()
- end
- end
- end
- wait()
- mouse = creeper:GetMouse()
- mouse.Button1Down:Connect(function()
- if urdead == false then
- urdead = true
- blowup()
- end
- end)
- Model0.HumanoidRootPart.CFrame = pos
- 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
- -- ANIMATION
- -- declarations
- local guy = awman
- local rs0 = CFrame.new(1, -1.5, -0.5, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- local rs1 = CFrame.new(0.5, 0.5, 0.5, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- local ls0 = CFrame.new(-1, -1.5, -0.5, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- local ls1 = CFrame.new(-0.5, 0.5, 0.5, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- local rh0 = CFrame.new(1, -1.5, 0.5, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- local rh1 = CFrame.new(0.5, 0.5, -0.5, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- local lh0 = CFrame.new(-1, -1.5, 0.5, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- local lh1 = CFrame.new(-0.5, 0.5, -0.5, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- local m = Instance.new("Motor6D")
- m.C0 = lh0
- m.C1 = lh1
- m.Name = "Left Hip"
- m.Part0 = guy.Torso
- m.Part1 = guy["Left Leg"]
- m.Parent = guy.Torso
- m.MaxVelocity = 0.1
- local m = Instance.new("Motor6D")
- m.C0 = rh0
- m.C1 = rh1
- m.Name = "Right Hip"
- m.Part0 = guy.Torso
- m.Part1 = guy["Right Leg"]
- m.Parent = guy.Torso
- m.MaxVelocity = 0.1
- local m = Instance.new("Motor6D")
- m.C0 = ls0
- m.C1 = ls1
- m.Name = "Left Shoulder"
- m.Part0 = guy.Torso
- m.Part1 = guy["Left Arm"]
- m.Parent = guy.Torso
- m.MaxVelocity = 0.1
- local m = Instance.new("Motor6D")
- m.C0 = rs0
- m.C1 = rs1
- m.Name = "Right Shoulder"
- m.Part0 = guy.Torso
- m.Part1 = guy["Right Arm"]
- m.Parent = guy.Torso
- m.MaxVelocity = 0.1
- local m = Instance.new("Motor6D")
- m.C1 = CFrame.new(0,-2.5,0)
- m.Name = "Neck"
- m.Part0 = guy.Torso
- m.Part1 = guy.Head
- m.Parent = guy.Torso
- m.MaxVelocity = 0.1
- local copy = guy:clone()
- local Figure = awman
- 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 toolAnim = "None"
- local toolAnimTime = 0
- -- functions
- function onRunning(speed)
- if speed>0 then
- pose = "Running"
- else
- pose = "Standing"
- end
- end
- function onDied()
- pose = "Dead"
- end
- function onJumping()
- pose = "Jumping"
- end
- function onClimbing()
- pose = "Climbing"
- end
- function onGettingUp()
- pose = "GettingUp"
- end
- function onFreeFall()
- pose = "FreeFall"
- end
- function onFallingDown()
- pose = "FallingDown"
- end
- function onSeated()
- pose = "Seated"
- end
- function onPlatformStanding()
- pose = "PlatformStanding"
- end
- function moveJump()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightHip.MaxVelocity = 0.5
- LeftHip.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 1
- LeftShoulder.DesiredAngle = -1
- RightHip.DesiredAngle = -1
- LeftHip.DesiredAngle = 1
- end
- -- same as jump for now
- function moveFreeFall()
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightHip.MaxVelocity = 0.5
- LeftHip.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 1
- LeftShoulder.DesiredAngle = -1
- RightHip.DesiredAngle = -1
- LeftHip.DesiredAngle = 1
- end
- function moveSit()
- RightShoulder.MaxVelocity = 0.15
- LeftShoulder.MaxVelocity = 0.15
- RightShoulder.DesiredAngle = 3.14 /2
- LeftShoulder.DesiredAngle = -3.14 /2
- RightHip.DesiredAngle = 3.14 /2
- LeftHip.DesiredAngle = -3.14 /2
- 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
- RightShoulder.DesiredAngle = 1.57
- return
- end
- if (toolAnim == "Slash") then
- RightShoulder.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 0
- return
- end
- if (toolAnim == "Lunge") then
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- RightHip.MaxVelocity = 0.5
- LeftHip.MaxVelocity = 0.5
- RightShoulder.DesiredAngle = 1.57
- LeftShoulder.DesiredAngle = 1.0
- RightHip.DesiredAngle = 1.57
- LeftHip.DesiredAngle = 1.0
- return
- end
- end
- function move(time)
- local amplitude
- local frequency
- if (pose == "Jumping") then
- moveJump()
- return
- end
- if (pose == "FreeFall") then
- moveFreeFall()
- return
- end
- if (pose == "Seated") then
- moveSit()
- return
- end
- local climbFudge = 0
- if (pose == "Running") then
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- amplitude = 1
- frequency = 9
- elseif (pose == "Climbing") then
- RightShoulder.MaxVelocity = 0.5
- LeftShoulder.MaxVelocity = 0.5
- amplitude = 1
- frequency = 9
- climbFudge = 3.14/2
- else
- amplitude = 0.1
- frequency = 1
- end
- desiredAngle = amplitude * math.sin(time*frequency)
- RightShoulder.DesiredAngle = -desiredAngle
- LeftShoulder.DesiredAngle = desiredAngle
- RightHip.DesiredAngle = desiredAngle
- LeftHip.DesiredAngle = -desiredAngle
- 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
- 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)
- -- main program
- local runService = game:service("RunService");
- while Figure.Parent~=nil do
- local _, time = wait(0.1)
- move(time)
- end
Add Comment
Please, Sign In to add comment