How to make a gravity control for a Sonic Game

already solved that before you replied (I made a sonic gravity controller...What do you guys think?) Now I just need to make it so when the player is going downwards, they gain speed and vice versa. I tried doing this yesterday, but the script I made to do that broke the gravity controller. Any help?

script that I made in order to make the player go faster when going downwards:

local HRP = script.Parent.HumanoidRootPart
local orientZ = HRP.Orientation.Z
local orientX = HRP.Orientation.X

script.Parent.Humanoid.Running:Connect(function()
	if orientZ == 0 then
		script.Parent.Humanoid.WalkSpeed = script.Parent.Humanoid.WalkSpeed + 10000000000
	end
end)

2 Likes

could you maybe elaborate on how you solved it?

1 Like

the problem of all these scripts is that they run to destroy and create the controller multiple times which essentially breaks the controller, the question is how do we do it, so that it runs the function 1 time instead of a hundred

I have also tried a method where where a player get a down VectorForce pushing the players down, by tinkering with the current local script in the controller I found out that you can make it so that whenever you fall the controller reset:

RUNSERVICE.Heartbeat:Connect(function(dt)
local height = Controller:GetFallHeight()
if height > 0 then
Controller:ResetGravity(Vector3.new(0, 1, 0))
end
end)

though the problem I have with this is with implementing the homing attack,of which requires the PlatformStand in the Humanoid to be marked as false, the problems that makes is that the roblox character sounds script orients on the material footsteps of which turns into air when you are at a more then 60 degree slope angle which stops any character sounds from playing. If you happen to have a version of the controller where that isnā€™t an issue it would help me alot!

1 Like

I didnā€™t read the Desc only the title so sorry of answered incorrectly

You can go to game settings then go to I assume it was avatar then you can change things there

that might work, Iā€™ll have to test it out, thanks for replying!

unfortunately it didnā€™t work, I did find a more complex solution though, but I still apreciated the help, thanks alot!

1 Like