So I've been doing some tests with scripts and stuff to make a Jetpack that goes upward when you hold down SpaceBar.
v Here's my unfinished script v
db = true script.Parent.Touched:connect(function(h) human = h.Parent:FindFirstChild("Humanoid") torso = h.Parent:FindFirstChild("Torso") if human ~= nil then if torso ~= nil then if db == true then db = false local upward = Instance.new("BodyForce", torso) upward.Name = "Y_Acess" -- Possible function to have in here that detects when or if space was held down? upward.Force = Vector3.new(0, 2100, 0) -- and elseif it wasn't being pressed or help down it would go to --upward.Force = Vector3.new(0, 0, 0) end -- db wait(10000) db = true end end end)
Hopefully, there should be a type of way to do this because I've used keyboard input functions before, but it was in a LocalScript.
Could somebody tell me if there's any possible way to have a keyboard input in a regular Script and not a LocalScript?
Thanks, -jack8699
local UIS = game:GetService("UserInputService") if UIS:IsKeyDown(Enum.KeyCode.Space) then print("Space held!") end