Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does my localscript not run? [Air Walk LocalScript]

so, ive been trying to make an ability where you can walk on air, and you press c to rise up and x to descend (go down). so i made a script like this, but it dosent even run. Like in the output, you can see print() is never executed.

local uis = game:GetService("UserInputService")
local airpad = Instance.new("Part", game.Workspace)
while true do
	wait()
	airpad.Position = game.Players.LocalPlayer.Character.Torso.Position
	airpad.Parent += Vector3.new(0,0,-5)
	uis.InputBegan:Connect(function(input, _gameproccesed)
		if input.UserInputType == Enum.KeyCode.C then
			local bv = Instance.new("BodyVelocity", airpad)
			bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
			bv.Velocity = Vector3.new(0,0,6)
			wait(2)
			bv:Destroy()
		end
		if input.UserInputType == Enum.KeyCode.X then
			local bv = Instance.new("BodyVelocity", airpad)
			bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
			bv.Velocity = Vector3.new(0,0,-6)
			wait(2)
			bv:Destroy()
		end
	end)
end

1 answer

It's isn't firing because you haven't defined the input ! Use InputBegan to make it works!

uis.InputBegan:Connect(function(input,gpe)
-- your script
end)

1 comment

0

exactly what i did.......

This discussion is preserved as it was. New answers, comments, and votes are closed.