Skip to content

Instantly share code, notes, and snippets.

@IfeeIhappy
Created January 24, 2022 01:56
Show Gist options
  • Save IfeeIhappy/294d8fc4d5c1c0c7414fc2ed9f8b4514 to your computer and use it in GitHub Desktop.
Save IfeeIhappy/294d8fc4d5c1c0c7414fc2ed9f8b4514 to your computer and use it in GitHub Desktop.
local Player = game.Players.LocalPlayer
local Char = Player.Character.Dummy
local Hum = Char:FindFirstChildOfClass'Humanoid'
local Torso = Char.Torso
local RArm = Char["Right Arm"]
local LArm = Char["Left Arm"]
local RLeg = Char["Right Leg"]
local LLeg = Char["Left Leg"]
local Root = Char:FindFirstChild'HumanoidRootPart'
local Head = Char.Head
local Sine = 0;
local Change = 1
local attack=false
local NeutralAnims=true
local timePos=30;
local walking=true;
local legAnims=true;
plr = Player
char = Char
tors = char.Torso
hed = char.Head
larm = char["Left Arm"]
rarm = char["Right Arm"]
lleg = char["Left Leg"]
rleg = char["Right Leg"]
root = char["HumanoidRootPart"]
Hum = char["HumanoidRootPart"]
char.Humanoid.MaxHealth = "inf"
char.Humanoid.Health = "inf"
local camera = workspace.CurrentCamera
local movement = 6
local footsound=0;
local WalkSpeed=32;
local Combo=0;
local CF = {N=CFrame.new,A=CFrame.Angles,fEA=CFrame.fromEulerAnglesXYZ}
local IN = Instance.new
local M = {C=math.cos,R=math.rad,S=math.sin,P=math.pi,RNG=math.random,MRS=math.randomseed,H=math.huge,RRNG = function(min,max,div) return math.rad(math.random(min,max)/(div or 1)) end}
function Weld(part0,part1,c0,c1)
local weld = IN("Weld")
weld.Parent = part0
weld.Part0 = part0
weld.Part1 = part1
weld.C0 = c0 or CF.N()
weld.C1 = c1 or CF.N()
return weld
end
-- [[ ForceField ]] --
local ff = Instance.new("ForceField",char)
ff.Visible = false
--[[ Theme ]]--
local theme = Instance.new("Sound",char.Torso)
theme.SoundId = "rbxassetid://7016742974"
theme.Volume = "1"
theme.Looped = true
theme:Play()
--[[ Remove Accessories ]]--
--[[table.foreach(char:GetDescendants(),function(i, v)
if v:IsA("Shirt") or v:IsA("Pants") or v:IsA("ShirtGraphics") then
v:Destroy()
end
if v:IsA("BasePart") then
v.Color = Color3.fromRGB(255, 255, 255)
end
end)]]--
--[[ Taunt ]]--
--[[ Instance Function ]]--
local CreateInstance = function(Object, ...)
local Obj = Instance.new(Object)
for i,v in next,(...) do
Obj[i] = v
end
return Obj
end
--[[ Weld Function ]]--
local Weld = function(Part0, Part1, Parent, CFrame)
local WeldInstance = CreateInstance("Weld",{
Part0 = Part0,
Part1 = Part1,
Parent = Parent,
C0 = CFrame
})
end
--[[ Script Parent ]]--
script.Parent = char
--[[ Variables ]]--
local speed = 3
local num = 0
local change = 2 / speed
local Tick = tick()
--[[ Character Welds ]]--
function createJoint(WP0, WP1, WC0X, WC0Y, WC0Z, WC1X, WC1Y, WC1Z, Name)
Joint = Instance.new("Weld")
Joint.Parent = char
Joint.Part0 = WP0
Joint.Part1 = WP1
Joint.C0 = CFrame.new(WC0X, WC0Y, WC0Z)
Joint.C1 = CFrame.new(WC1X, WC1Y, WC1Z)
Joint.Name = Name
return Joint
end
local Neck = createJoint(char["Torso"], char["Head"], 0, 1, 0, 0, -1 / 2, 0, "Neck")
local RootJoint = createJoint(char["HumanoidRootPart"], char["Torso"], 0, 0, 0, 0, 0, 0, "RootJoint")
local LShoulder = createJoint(char["Torso"], char["Left Arm"], -1.5, 0.5, 0, 0, 0.5, 0, "Left Shoulder")
local RShoulder = createJoint(char["Torso"], char["Right Arm"], 1.5, 0.5, 0, 0, 0.5, 0, "Right Shoulder")
local LHip = createJoint(char["Torso"], char["Left Leg"], -0.5, -1, 0, 0, 1, 0, "Left Hip")
local RHip = createJoint(char["Torso"], char["Right Leg"], 0.5, -1, 0, 0, 1, 0, "Right Hip")
local NeckC0 = Neck.C0
local RootC0 = RootJoint.C0
local LShoulderC0 = LShoulder.C0
local RShoulderC0 = RShoulder.C0
local LHipC0 = LHip.C0
local RHipC0 = RHip.C0
--[[ TweenService ]]--
local TweenService = game:GetService("TweenService")
--[[ Tween ]]--
local AnimGoal = {}
local AnimGoal2 = {}
local AnimGoal3 = {}
local AnimGoal4 = {}
local AnimGoal5 = {}
local AnimGoal6 = {}
function Tween(P, I, G)
pcall(function()
local Tween = TweenService:Create(P, I, G)
Tween:Play()
end)
end
function Lerp(a,b,t)-- made by LolPotatoe12
return a:Lerp(CFrame.new(b.p*tors.Size.Z)*CFrame.Angles(b:ToEulerAnglesXYZ()),t)
end
local Huma = char.Humanoid
--[[ Animation ]]--
Mouse = Player:GetMouse()
local attack = false
local test = false
Mouse.KeyDown:connect(function(k)
if k == "f" then
print(Mouse.Hit.p)
end
end)
Mouse.KeyDown:connect(function(k)
if k == "e" then
Anim = "Wave"
end
end)
--[[ Waving Animation Key = E]]
--[[INFORMATION
Positions :
X Left to Right
Y Up and Down
Z Front to back
Angles:
X Front to back
Y Left to Right
Z Left To Right (SideWays)
--]]
print(attack)
game:GetService("RunService").Stepped:Connect(function()
Sine=Sine+Change
local Walking = (math.abs(Root.Velocity.x) > 1 or math.abs(Root.Velocity.z) > 1)
local State = (Huma.PlatformStand and 'Paralyzed' or Huma.Sit and 'Sit' or not hitfloor and Root.Velocity.y < -1 and "Fall" or not hitfloor and Root.Velocity.y > 1 and "Jump" or hitfloor and Walking and "Walk" or hitfloor and "Idle")
Huma.WalkSpeed = WalkSpeed
local sidevec = math.clamp((Root.Velocity*Root.CFrame.rightVector).X+(Root.Velocity*Root.CFrame.rightVector).Z,-Huma.WalkSpeed,Huma.WalkSpeed)
local forwardvec = math.clamp((Root.Velocity*Root.CFrame.lookVector).X+(Root.Velocity*Root.CFrame.lookVector).Z,-Huma.WalkSpeed,Huma.WalkSpeed)
local sidevelocity = sidevec/Huma.WalkSpeed
local forwardvelocity = forwardvec/Huma.WalkSpeed
num = num + change
exactVel = CFrame.new(root.CFrame:vectorToObjectSpace(root.Velocity))
vel = Vector3.new(math.clamp(exactVel.x,-16,16),math.clamp(exactVel.y,-16,16),math.clamp(exactVel.z,-16,16))
if not char["Humanoid"].Sit then
if char["Humanoid"]:GetState() ~= Enum.HumanoidStateType.Climbing then
if Hum.Velocity.y > 3 then
Anim = "Jump"
elseif Hum.Velocity.y < -3 then
Anim = "Fall"
else
if math.abs(Hum.Velocity.x) > 3 or math.abs(Hum.Velocity.z) > 3 and char["Humanoid"]:GetState() ~= Enum.HumanoidStateType.Freefall then
Anim = "Walk"
elseif math.abs(Hum.Velocity.x) < 3 or math.abs(Hum.Velocity.z) < 3 then
Anim = "Idle"
end
end
else
Anim = "Climb"
end
else
Anim = "Sit"
end
if Anim == "Idle" then
Tick = Tick + 1
local Speed = 1
AnimGoal.C0 = Lerp(Neck.C0,NeckC0* CFrame.new(0,0,0) * CFrame.Angles(0 - 0.2* math.sin(Tick/15),0,0), Speed) -- Head
AnimGoal2.C0 = Lerp(RootJoint.C0,RootC0* CFrame.new(0,0.2 * math.sin(Tick/15),0) * CFrame.Angles(0.1,0,0), Speed) -- Torso
AnimGoal3.C0 = Lerp(RShoulder.C0,RShoulderC0* CFrame.new(0,0,0) * CFrame.Angles(0,-0.2,0 - 0.1* math.sin(Tick/15)), Speed) -- Right Arm
AnimGoal4.C0 = Lerp(LShoulder.C0,LShoulderC0* CFrame.new(0,0,0) * CFrame.Angles(0,0.2,0 + 0.1* math.sin(Tick/15)), Speed)-- Left Arm
AnimGoal5.C0 = Lerp(RHip.C0,RHipC0* CFrame.new(0.2,-0.2* math.sin(Tick/15),-0.2 - 0.2* math.sin(Tick/15)) * CFrame.Angles(-0.2 - 0.1* math.sin(Tick/15),-0.5,0), Speed)-- Right Leg
AnimGoal6.C0 = Lerp(LHip.C0,LHipC0* CFrame.new(-0.2,-0.2* math.sin(Tick/15),-0.2 - 0.2* math.sin(Tick/15)) * CFrame.Angles(-0.2 - 0.1* math.sin(Tick/15),0.5,0), Speed)-- Left Leg
elseif Anim == "Wave"then
local Speed = 1
Tick = Tick + 1
AnimGoal.C0 = Lerp(Neck.C0,NeckC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed) -- Head
AnimGoal2.C0 = Lerp(RootJoint.C0,RootC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed) -- Torso
AnimGoal3.C0 = Lerp(RShoulder.C0,RShoulderC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed) -- Right Arm
AnimGoal4.C0 = Lerp(LShoulder.C0,LShoulderC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed)-- Left Arm
AnimGoal5.C0 = Lerp(RHip.C0,RHipC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed)-- Right Leg
AnimGoal6.C0 = Lerp(LHip.C0,LHipC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed)-- Left Leg
elseif Anim == "Walk" then
print(attack)
if test == false then
local wsVal = 10
Tick = Tick + 1
local Speed = 1
AnimGoal.C0 = Lerp(Neck.C0,NeckC0* CFrame.new(0,0,0) * CFrame.Angles(0.1 + 0.1 * math.sin(Tick/5), 0,0), Speed) -- Head
AnimGoal2.C0 = Lerp(RootJoint.C0,RootC0* CFrame.new(0,0.2 * math.sin(Tick/5),0) * CFrame.Angles(-0.2, 0 - 0.05* math.sin(Tick/5),0), Speed) -- Torso
AnimGoal3.C0 = Lerp(RShoulder.C0,RShoulderC0* CFrame.new(0,0,0 - 0.5 * math.sin(Tick/8)) * CFrame.Angles(0 + 1.5 * math.sin(Tick/8),0,0.2), Speed) -- Right Arm
AnimGoal4.C0 = Lerp(LShoulder.C0,LShoulderC0* CFrame.new(0,0,0 + 0.5 * math.sin(Tick/8)) * CFrame.Angles(0 - 1.5 * math.sin(Tick/8),0,-0.2), Speed)-- Left Arm
AnimGoal5.C0 = Lerp(RHip.C0,RHipC0* CFrame.new(0,0,0.2) * CFrame.Angles(0 + 1 * math.sin(Tick/5),0,0), Speed)-- Right Leg
AnimGoal6.C0 = Lerp(LHip.C0,LHipC0* CFrame.new(0,0,0/2) * CFrame.Angles(0 - 1 * math.sin(Tick/5),0,0), Speed)-- Left Leg
end
elseif Anim == "Jump" then
Tick = Tick + 5
local Speed = 1
AnimGoal.C0 = Lerp(Neck.C0,NeckC0* CFrame.new(0,0,0) * CFrame.Angles(0.3,0,0), Speed) -- Head
AnimGoal2.C0 = Lerp(RootJoint.C0,RootC0* CFrame.new(0,0,0) * CFrame.Angles(-0.2,0,0), Speed) -- Torso
AnimGoal3.C0 = Lerp(RShoulder.C0,RShoulderC0* CFrame.new(0,0,0.2) * CFrame.Angles(0,-0.3,0.4), Speed) -- Right Arm
AnimGoal4.C0 = Lerp(LShoulder.C0,LShoulderC0* CFrame.new(0,0,0.2) * CFrame.Angles(0,0.3,-0.4), Speed)-- Left Arm
AnimGoal5.C0 = Lerp(RHip.C0,RHipC0* CFrame.new(0,0,-0.2) * CFrame.Angles(-0.2,0,0.1), Speed)-- Right Leg
AnimGoal6.C0 = Lerp(LHip.C0,LHipC0* CFrame.new(0,0,-0.2) * CFrame.Angles(-0.2,0,-0.1), Speed)-- Left Leg
elseif Anim == "Fall" then
Tick = Tick + 2
local Speed = 1
AnimGoal.C0 = Lerp(Neck.C0,NeckC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed) -- Head
AnimGoal2.C0 = Lerp(RootJoint.C0,RootC0* CFrame.new(0,0,0) * CFrame.Angles(-0.2,0,0), Speed) -- Torso
AnimGoal3.C0 = Lerp(RShoulder.C0,RShoulderC0* CFrame.new(0,0,0.2) * CFrame.Angles(0,-0.3,0.4), Speed) -- Right Arm
AnimGoal4.C0 = Lerp(LShoulder.C0,LShoulderC0* CFrame.new(0,0,0.2) * CFrame.Angles(0,0.3,-0.4), Speed)-- Left Arm
AnimGoal5.C0 = Lerp(RHip.C0,RHipC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed)-- Right Leg
AnimGoal6.C0 = Lerp(LHip.C0,LHipC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed)-- Left Leg
elseif Anim == "Climb" then
local Speed = 0.5
AnimGoal.C0 = Lerp(Neck.C0,NeckC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed) -- Head
AnimGoal2.C0 = Lerp(RootJoint.C0,RootC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed) -- Torso
AnimGoal3.C0 = Lerp(RShoulder.C0,RShoulderC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed) -- Right Arm
AnimGoal4.C0 = Lerp(LShoulder.C0,LShoulderC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed)-- Left Arm
AnimGoal5.C0 = Lerp(RHip.C0,RHipC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed)-- Right Leg
AnimGoal6.C0 = Lerp(LHip.C0,LHipC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed)-- Left Leg
elseif Anim == "Sit" then
local Speed = 0.2
AnimGoal.C0 = Lerp(Neck.C0,NeckC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed) -- Head
AnimGoal2.C0 = Lerp(RootJoint.C0,RootC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed) -- Torso
AnimGoal3.C0 = Lerp(RShoulder.C0,RShoulderC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed) -- Right Arm
AnimGoal4.C0 = Lerp(LShoulder.C0,LShoulderC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed)-- Left Arm
AnimGoal5.C0 = Lerp(RHip.C0,RHipC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed)-- Right Leg
AnimGoal6.C0 = Lerp(LHip.C0,LHipC0* CFrame.new(0,0,0) * CFrame.Angles(0,0,0), Speed)-- Left Leg
end
Tween(Neck, TweenInfo.new(0.25, Enum.EasingStyle.Circular), AnimGoal)
Tween(RootJoint, TweenInfo.new(0.25, Enum.EasingStyle.Circular), AnimGoal2)
Tween(RShoulder, TweenInfo.new(0.25, Enum.EasingStyle.Circular), AnimGoal3)
Tween(LShoulder, TweenInfo.new(0.25, Enum.EasingStyle.Circular), AnimGoal4)
Tween(RHip, TweenInfo.new(0.25, Enum.EasingStyle.Circular), AnimGoal5)
Tween(LHip, TweenInfo.new(0.25, Enum.EasingStyle.Circular), AnimGoal6)
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment