Hello there! I've been asking quite a few questions lately. lol

Today I tested out a function called SetStateEnabled for a script that I'm working on. (Where players float :o ). The issue, however, is that when I go into the air I either can't move, or when I'm moving and start floating I can't stop. There's no errors being returned either. Is there an alternative/fix to this?

This is the script I'm using:

local UserInputService = game:GetService('UserInputService')
local player = game:GetService('Players').LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild('Humanoid')
local hrp = char:WaitForChild('HumanoidRootPart')

local EKey, QKey = 0, 0
local BodyVelocity = Instance.new('BodyVelocity')
BodyVelocity.MaxForce = Vector3.new(0,3e4,0)
BodyVelocity.P = 3e4
BodyVelocity.Velocity = Vector3.new(0,0,0)
BodyVelocity.Parent = hrp

hum:SetStateEnabled(5, false) --<Disables Freefall

while true do
	if UserInputService:IsKeyDown('E') then
		EKey = 1
	else
		EKey = 0
	end
	if UserInputService:IsKeyDown('Q') then
		QKey = 1
	else
		QKey = 0
	end
	BodyVelocity.Velocity = Vector3.new(0, EKey-QKey, 0) * 16
	wait(1/44)
end
BodyVelocity:Destroy()

Tyvm in advance! ^^

2 comments

0

Why is it that you always end up solving your own problem?

0

^ I had help on the discord. :P