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 comment
exactly what i did.......