Hi again,
I still don’t understand why it isn’t working, I really wish Roblox has an idle feature so it can be fixed easily.
The server script as mentioned before on my progression topic is empty and will be used to create a folder for the player, create a remote that plays the animation for everybody else (not changing everybody’s animations, just a show-off)
I only need some examples on how I could approach this problem
Here:
local pose = "Standing"
task.wait(0.5)
local player = game:GetService("Players").LocalPlayer or game:GetService("Players").PlayerAdded:Wait()
local char = player.Character or player.CharacterAdded:Wait()
local RunService = game:GetService("RunService")
local charParts = {
--Head = char:FindFirstChild("Head"),
Torso = char:FindFirstChild("Torso"),
--Arms = {
-- LeftArm = char:FindFirstChild("LeftArm"),
-- RightArm = char:FindFirstChild("RightArm")
--},
--Legs = {
-- LeftLeg = char:FindFirstChild("LeftLeg"),
-- RightLeg = char:FindFirstChild("RightLeg")
--},
HRP = char:FindFirstChild("HumanoidRootPart")
}
local Motor6DS = {
RootJoint = charParts.HRP:FindFirstChild("RootJoint"),
Neck = charParts.Torso:FindFirstChild("Neck"),
Shoulders = {
LeftShoulder = charParts.Torso:FindFirstChild("Left Shoulder"),
RightShoulder = charParts.Torso:FindFirstChild("Right Shoulder")
},
Hips = {
LeftHip = charParts.Torso:FindFirstChild("Left Hip"),
RightHip = charParts.Torso:FindFirstChild("Right Hip")
}
}
-- States --
function onRunning(speed)
if speed > 0 then
pose = "Running"
elseif speed == 0 then
pose = "Standing"
end
end
-- Function --
local function StateProvider()
local hum = char:WaitForChild("Humanoid")
-- if it's considered a hack, then i've probably cheated the game a little bit.
-- the idea came from printing the state by using magnitude (1 = walk, 0 = idle).
while true do
task.wait(0.1)
local mag = math.round(hum.MoveDirection.Magnitude)
if mag > 0 then
onRunning(1) -- Running
else
onRunning(0) -- Idle
end
end
end
-- Animations --
local function Move()
local rad = 0.75
local t = 8 * 1.25
local degree = 0
local degree2 = 0
local function AnimRun()
degree += 1
degree2 -= 1
local rZ = math.sin(math.rad(degree) * t) * rad
local rZ2 = math.sin(math.rad(degree2) * t) * rad
local rZ3 = math.sin(math.rad(degree) * t) * rad / 6
local rZ4 = math.sin(math.rad(degree2) * t) * rad / 6
local rX = math.sin(math.rad(degree2) * (t * 2)) * rad / 12
local cframe = CFrame.Angles(0,0,rZ)
local cframe2 = CFrame.Angles(0,0,rZ2)
local cframe3 = CFrame.Angles(0,0,rZ3)
local cframe4 = CFrame.Angles(rX,0,rZ4)
Motor6DS.Shoulders.LeftShoulder.Transform = cframe2
Motor6DS.Shoulders.RightShoulder.Transform = cframe2
Motor6DS.Hips.LeftHip.Transform = cframe
Motor6DS.Hips.RightHip.Transform = cframe
Motor6DS.RootJoint.Transform = cframe3
Motor6DS.Neck.Transform = cframe4
end
local runStepped = RunService.Stepped:Connect(AnimRun)
if pose == "Running" then
runStepped.Connected = true
elseif pose == "Standing" then
runStepped.Connected = false
Motor6DS.Shoulders.LeftShoulder.Transform = CFrame.Angles(0,0,0)
Motor6DS.Shoulders.RightShoulder.Transform = CFrame.Angles(0,0,0)
Motor6DS.Hips.LeftHip.Transform = CFrame.Angles(0,0,0)
Motor6DS.Hips.RightHip.Transform = CFrame.Angles(0,0,0)
Motor6DS.RootJoint.Transform = CFrame.Angles(0,0,0)
Motor6DS.Neck.Transform = CFrame.Angles(0,0,0)
end
end
StateProvider()
while char.Parent~=nil do
task.wait(0.1)
Move()
end
Yes, some parts are taken from the old Roblox animation system (which also uses Motor6D Manipulation).
finally, i can post my code without most being normal text