I don't know what I'm doing wrong
I'm trying to make it stop when you stop holding down
local CoolPartFolder = game.Workspace
UserInputService = game:GetService("UserInputService")
keypress = false
UserInputService.InputBegan:Connect(function(input)
`if UserInputService.InputEnded then`
`keypress = false`
`end`
`if` `UserInputService.InputBegan then`
`keypress = true`
`end`
`if input.KeyCode == Enum.KeyCode.E then`
`if UserInputService.InputBegan then`
`keypress = true`
`elseif UserInputService.InputEnded then`
`keypress = false`
`while keypress == true do`
task.wait(0.1)
local NewInstance = Instance.new("Part")
NewInstance.Parent = CoolPartFolder
NewInstance.Position = Vector3.new(1,100,1)
`end`
`end`
`end`
end)
Posted Aug 10, 2025, 7:40 PM UTC
10