Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Direction Freeze After Jump?

Asked by 4 years ago

Recently I've made a game that has a style similar to 2006 - 2010 ROBLOX. I want to make the games jump look similar to Super Nostalgia Zones jump where when they jump, their direction freezes, but they can still jump forward. Here is the jumping script, I just need it to freeze direction on jump and falling. Thanks!

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 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 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.1
    LeftShoulder.MaxVelocity = 0.1
    RightShoulder.DesiredAngle = 3.14
    LeftShoulder.DesiredAngle = -3.14
    RightHip.DesiredAngle = 0
    LeftHip.DesiredAngle = 0
end


-- same as jump for now

function moveFreeFall()
    RightShoulder.MaxVelocity = 0.2
    LeftShoulder.MaxVelocity = 0.2
    RightShoulder.DesiredAngle = 3.14
    LeftShoulder.DesiredAngle = -3.14
    RightHip.DesiredAngle = 0
    LeftHip.DesiredAngle = 0
end

Please help soon! D:

0
Note: there is more to the script but its just other animations. All I need is a direction freeze on jump so I didn't include the rest of the script. Or1g1nal_Player 22 — 4y

1 answer

Log in to vote
0
Answered by
Elyzzia 1294 Moderation Voter
4 years ago

just turn off the Humanoid.AutoRotate property while the player is in the air, it doesn't have anything to do with animations

you can do this easily by checking the player's FloorMaterial whenever it changes, if the FloorMaterial is air then the player is. well, in the air

-- GetPropertyChangedSignal is better than Changed when you're only checking a single property
humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
    if humanoid.FloorMaterial == Enum.Material.Air then -- player is in the air, so disable rotation
        humanoid.AutoRotate = false
    else
        humanoid.AutoRotate = true
    end
end)
0
Where do I put this and what type of script? Or1g1nal_Player 22 — 4y
0
really, you can put it in any type of script, but i'd recommend putting it in a localscript since a server script has a nasty delay Elyzzia 1294 — 4y
0
where do i put the script though like Workspace? StarterChar? Or1g1nal_Player 22 — 4y
0
where do i put the script though like Workspace? StarterChar? Or1g1nal_Player 22 — 4y
Ad

Answer this question