idk how to do that… (idk how to script that good, im sorry)
i found it out nvm
idk how to do that… (idk how to script that good, im sorry)
i found it out nvm
now it prints this:
ContextActionService:BindAction called with an invalid hotkey (should be either Enum.KeyCode, Enum.UserInputType or string)
Forgot to implement it.
local UserInputService = game:GetService("UserInputService")
-- Assuming the seat is directly under the Workspace
local seat = game.Workspace:WaitForChild("Seat")
-- Function to handle player input
local function onInputBegan(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
print("Player pressed key:", input.KeyCode)
end
end
-- Connect the input function to the InputBegan event of the UserInputService
UserInputService.InputBegan:Connect(function(input, processed)
-- Check if the input is not being processed and the occupant is in the seat
if not processed and seat.Occupant then
onInputBegan(input)
end
end)
Fixed
ok that works, thanks!
chat limit
sorry but 1 more question, how do i get the raw letter?
right now it does “Enum.KeyCode.Key” but i want to just print “Key”
That’s simple just use Name property of the input.KeyCode
local UserInputService = game:GetService("UserInputService")
-- Assuming the seat is directly under the Workspace
local seat = game.Workspace:WaitForChild("Seat")
-- Function to handle player input
local function onInputBegan(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
-- Get the raw letter from the KeyCode
local keyName = input.KeyCode.Name
print("Player pressed key:", keyName) -- here we are printing the key pressed
end
end
-- Connect the input function to the InputBegan event of the UserInputService
UserInputService.InputBegan:Connect(function(input, processed)
-- Check if the input is not being processed and the occupant is in the seat
if not processed and seat.Occupant then
onInputBegan(input)
end
end)
that worked, thanks
char limitttttttttttt
Glad it worked, btw if you are new in scripting i would recommend you watching basic scripting videos or reading the roblox documentation.
Try this
id rather just try to find scripters, im lazy… but i wanna get this done asap
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.