Long Jump Script isn't Working

Introduction

Hello! So I’m trying to make a platformer and adventure game! I’m trying to make a game similar to Super Mario 64, ( Basically trying to make my own Mario themed type game. ) I’m trying to make keybinds/controls that will be like SM64 all of these:

SM64 Controls

Use These 2 For Reference

Super Mario 64 Speedrun Movement Guide - YouTube

Controls of SM64 that I'm trying to Replicate

While running, quickly turn around + : Sideways Somersault
Upon hitting a wall, : Wall Jump
→ upon landing: Double Jump
→ → : Triple Jump (while running); lift off (wearing the Wing Cap)
→ : Jump Kick (from a standstill); Midair Dive (while running)
→ → : Punch → Punch → Kick
In midair, : Ground Pound

  • : Crawl
  • : Backwards Somersault (from a standstill); Long Jump (while running)
  • : Sweep Kick (from a standstill); Slide Kick (while running)

The above text is from the Super Mario Wiki and is available under a Creative Commons license. Attribution must be provided through a list of authors or a link back to the original article. Source: Super Mario 64 - Super Mario Wiki, the Mario encyclopedia

The issue is, when I was trying to make the long jump, I was trying to track down what state the player is in, so like for an e.g, ( If player.State = running and Key.LeftShift.Down = true and Key.Space.Down = true then > LongJump() ) Same for all of the other controls like a Backwards Sumorsaw

The Issue

For some reason, In my script that was re-created and edited by @weegismrts ( Thanks for that )
when I started trying to make it so it would check the players state then this is what happened:

The Output

  11:25:07.520  Workspace.FallDamageScript:25: Incomplete statement: expected assignment or a function call  -  Studio - FallDamageScript:25
  11:25:20.862  State is not a valid member of Humanoid "Workspace.NubblyFry.Humanoid"  -  Client - LongJump:42
  11:25:20.863  Stack Begin  -  Studio
  11:25:20.864  Script 'Workspace.NubblyFry.LongJump', Line 42  -  Studio - LongJump:42
  11:25:20.864  Stack End  -  Studio
  11:25:21.678  0.5, 0.5  -  Server
  11:25:21.915  0.5, 0.5  -  Client
  11:29:31.839  Super Oofy 64 auto-recovery file was created  -  Studio - C:/Users/mrtix/OneDrive/Documents/ROBLOX/AutoSaves

The Script

local canBoost = true

local UIS = game:GetService("UserInputService")

local c = script.Parent

local LeftShiftInDown = false

local Anim = c.Humanoid:LoadAnimation(game.ReplicatedStorage.LongJumpAnim)

function VelocityFunction()
	if canBoost then
		canBoost = false
		local V = Instance.new("BodyVelocity", c.HumanoidRootPart)
		V.MaxForce = Vector3.new(40000,0,40000)
		V.Velocity = c.HumanoidRootPart.CFrame.LookVector * 100

		c.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)

		Anim:Play()
		wait(.25)
		c.HumanoidRootPart.CFrame = c.HumanoidRootPart.CFrame + Vector3.new(0,-0.02,0)
		wait(.8)
		Anim:Stop()
		V:Destroy()
		canBoost= true
	end
end

UIS.InputBegan:Connect(function(key,chat)
	if key.KeyCode == Enum.KeyCode.LeftShift then
		LeftShiftInDown = true
	end
end)
UIS.InputEnded:Connect(function(key,chat)
	if key.KeyCode == Enum.KeyCode.LeftShift then
		LeftShiftInDown = false
	end
end)

UIS.InputBegan:Connect(function(key,chat)
	if key.KeyCode == Enum.KeyCode.Space and LeftShiftInDown and c.Humanoid:State(Enum.HumanoidStateType.Running) then
		VelocityFunction()
	end
end)

-- I Recommend reading the Introduction to The Script so you can get a better understanding of what Im trying to create.

There’s no State function for humanoids, I think you mean to do

c.Humanoid:GetState() == Enum.HumanoidStateType.Running
1 Like
  11:57:28.037  Workspace.FallDamageScript:25: Incomplete statement: expected assignment or a function call  -  Studio - FallDamageScript:25
  11:57:42.023  Infinite yield possible on 'ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents")'  -  Studio
  11:57:42.023  Stack Begin  -  Studio
  11:57:42.023  Script 'Players.NubblyFry.PlayerScripts.ChatScript.ChatMain', Line 51  -  Studio - ChatMain:51
  11:57:42.023  Stack End  -  Studio
  11:57:45.096  0.5, 0.5  -  Server
  11:57:45.399  0.5, 0.5  -  Client

Those seem to be from other scripts, the first error is from FallDamageScript, separate from the LongJump script.

What’s the code in FallDamageScript, you probably forgot to write some syntax

1 Like

The Long Jump Still Didn’t work for some reason, and I was Running.

Im trying to Check the Players Humanoid State, So If their Running and they have Space and LShift Pressed down then, A Long Jump Is Preformed.

1 Like

Can you lend me the rbxm.file for that, So I can check the problem.

1 Like

Question, How can I transport a script into a rbxm file?

Let’s do this instead, Save every details that the script needs. and lend me the link for it.

1 Like
UIS.InputBegan:Connect(function(key,chat)
	if key.KeyCode == Enum.KeyCode.Space and LeftShiftInDown and c.Humanoid:State(Enum.HumanoidStateType.Running) then
		VelocityFunction()
	end
end)

c.Humanoid:State(Enum.HumanoidStateType.Running) Syntax error, change that to “ChangeState” Instead of “State”

1 Like

https://developer.roblox.com/en-us/api-reference/function/Humanoid/GetState

1 Like

I can do a long jump, but I can do it when Im standing

try this

if Humanoid.MoveDirection ~= Vector3.new(0,0,0) then

would I made it return?

also will their work with all Rigs? I made a new Oofy Model that looks less blocky like, and more like a Mario 64 Type

Just do

UIS.InputBegan:Connect(function(key,chat)
	if key.KeyCode == Enum.KeyCode.Space and LeftShiftInDown and Humanoid.MoveDirection ~= Vector3.new(0,0,0)  then
		VelocityFunction()
	end
end)

And yes it works with any rig

1 Like

Unknown Global: ‘Humanoid’


Add a Humanoid Variable at the top

Humanoid = script.Parent:WaitForChild(“Humanoid”)

1 Like