Might need to work on the brightness for compatibility there.
Why are you coping so hard? I told you originally, I was just going to try writing it differently myself.
Youāre the one who wanted to one-up my script so I think me criticizing your script is fairā¦ (Which, now that Iām looking again, you deleted your message saying thatā¦ Oddā¦)
Yea thatās the problemā¦ thereās a reason why Legacy
and Compatibility
were replaced!
Heh no I did not delete it, some dimwit reported it.
Works great with contrast adjustment. Adjusting by 0.5 is good.
Both of these images are compatibility:
The 2nd one is the one you posted, and I didnāt make any modifications to the lighting other than changing the contrast to .3 and changing technology to compatibility.
So please, donāt consider compatibility ugly when it looks like shadowmap but without the shadows.
I just realized that the tool animations are missing! I improved the animate script as well to include this and also slow down the update frequency when animations are āidleā (it makes it look more classic as well).
Additionally, it will also adjust the speed of the walk animation depending on the running speed. Hereās the updated script if you want to include some additions or ideas from it:
local RunService = game:GetService("RunService")
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local Torso = Character:WaitForChild("Torso")
local LeftShoulder = Torso:WaitForChild("Left Shoulder")
local RightShoulder = Torso:WaitForChild("Right Shoulder")
local LeftHip = Torso:WaitForChild("Left Hip")
local RightHip = Torso:WaitForChild("Right Hip")
local Neck = Torso:WaitForChild("Neck")
local GlobalSpeed = 0
local toolAnim = "None"
local toolAnimTime = .3
local updateFrequency = 0.2
local dynamicUpdateFrequency = true --Throttle the animations when necessary.
-- Current Animation
local Pose = "Standing"
-- Connect Events
Humanoid.Died:Connect(function()
-- No need to animate the dead!
script:Destroy()
end)
Humanoid.Running:Connect(function(Speed)
-- Sometimes the speed can get stuck at extremely small values, so this prevents the character running in place
-- Change '0.1' to '0' for the original behavior
if Speed > 0.1 then
Pose = "Running"
GlobalSpeed = Speed / 16 --default walkspeed
else
Pose = "Standing"
GlobalSpeed = 0
end
end)
Humanoid.Swimming:Connect(function()
Pose = "Running"
end)
Humanoid.Jumping:Connect(function()
Pose = "Jumping"
end)
Humanoid.Climbing:Connect(function()
Pose = "Climbing"
end)
Humanoid.FreeFalling:Connect(function()
Pose = "FreeFall"
end)
Humanoid.Seated:Connect(function()
Pose = "Seated"
end)
-- Update
local function JumpAnimation()
LeftShoulder.MaxVelocity = 0.5
RightShoulder.MaxVelocity = 0.5
LeftShoulder:SetDesiredAngle(-math.pi)
RightShoulder:SetDesiredAngle(math.pi)
LeftHip:SetDesiredAngle(0)
RightHip:SetDesiredAngle(0)
end
local function SitAnimation()
LeftShoulder.MaxVelocity = 0.15
RightShoulder.MaxVelocity = 0.15
LeftShoulder:SetDesiredAngle(-math.pi / 2)
RightShoulder:SetDesiredAngle(math.pi / 2)
LeftHip:SetDesiredAngle(-math.pi / 2)
RightHip:SetDesiredAngle(math.pi / 2)
end
function getTool()
for _, kid in ipairs(Character: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:SetDesiredAngle(1.57)
return
end
if (toolAnim == "Slash") then
RightShoulder.MaxVelocity = 0.5
RightShoulder:SetDesiredAngle(0)
return
end
if (toolAnim == "Lunge") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightHip.MaxVelocity = 0.5
LeftHip.MaxVelocity = 0.5
RightShoulder:SetDesiredAngle(1.57)
LeftShoulder:SetDesiredAngle(1.0)
RightHip:SetDesiredAngle(1.57)
LeftHip:SetDesiredAngle(1.0)
return
end
end
local lastUpdate = 0
RunService.RenderStepped:Connect(function()
local time = time()
if time - lastUpdate < updateFrequency then
return
end
lastUpdate = time
if Pose == "Jumping" or Pose == "FreeFall" then
JumpAnimation()
return
end
if Pose == "Seated" then
SitAnimation()
return
end
local Amplitude = 0.1
local Frequency = 1
-- I have no idea why this is called 'ClimbFudge'
local ClimbFudge = 0
if Pose == "Running" then
LeftShoulder.MaxVelocity = 0.15
RightShoulder.MaxVelocity = 0.15
Amplitude = 1
Frequency = 9 * GlobalSpeed
elseif Pose == "Climbing" then
LeftShoulder.MaxVelocity = 0.5
RightShoulder.MaxVelocity = 0.5
Amplitude = 1
Frequency = 9
ClimbFudge = math.pi
end
local DesiredAngle = Amplitude * math.sin(time * Frequency)
LeftShoulder:SetDesiredAngle(DesiredAngle - ClimbFudge)
RightShoulder:SetDesiredAngle(DesiredAngle + ClimbFudge)
LeftHip:SetDesiredAngle(-DesiredAngle)
RightHip:SetDesiredAngle(-DesiredAngle)
local tool = getTool()
if tool then
local animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject:Destroy()--.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
toolAnim = "None"
toolAnimTime = 0
end
if dynamicUpdateFrequency then
updateFrequency = (Frequency > 1 and 0) or .1
end
end)
I apologize in advance for using camelCase variable names.
Sounds like a good idea! Not only would this be more performant, but it could possibly work with R15 using this thing I made to create animations with both rigs:
If you donāt choose to use it, thatās fine. I think it would be neat though.