Orb Starter Character

Hi,

This is a ball as StarterCharacter.

I fixed a few problems in my old project. This time the character works really stable.
Old Project: Orb Character (Outdated)

New features:
-Better jump velocity
-Fixed high frame-rate issues (Thanks to Agent_Invalid)

Game Link: Orb Version 2 [Open Source] - Roblox
Example Video: (Outdated use game link instead)

Source Code:

local human = script.Parent.Humanoid
local ball = script.Parent.Ball

local debounce = true
local uis = game:GetService("UserInputService")
local jumppower = "60"

function move(dt)

	if human.FloorMaterial ~= Enum.Material.Air then
		ball.Velocity = ball.Velocity + (human.MoveDirection * human.WalkSpeed) * dt 
		
	end
	
	if human.FloorMaterial == Enum.Material.Air then
		ball.Velocity = ball.Velocity + (human.MoveDirection * human.WalkSpeed) * dt 
	end
end

uis.InputBegan:Connect(function(i)
	if i.KeyCode == Enum.KeyCode.Space and debounce == true then
		debounce = false
		ball.Velocity = ball.Velocity + Vector3.new(0,jumppower,0) 
		wait(0.6)
		--Vector3.new(0,jumppower,0)
		debounce = true
	end
end)

game:GetService("RunService").RenderStepped:Connect(move)

--[[You can credit me if you want.

-- renderlander]]




9 Likes

Please use local function and task.wait, since they generally make better performance.

and velocity is decrepated and shouldn’t be used anymore, instead use assembly linear velocity.

2 Likes

Why are you connecting this function to InputBegan every frame? Same with the InputEnded

1 Like

Wait a minute, that would be HIGHLY inefficent and would create mass lag if you play for an extended amount of time, since it’s going to be checking for input MANY times.

1 Like

Thanks for your reply, what should I use instead?

Connect to InputBegan and InputEnded only ONCE, not every frame.

1 Like

Are you able to make it so that if the player dies they can respawn?