So, i dont think i have any of this wrong XD but anyway im trying to make something so when the F key is pressed it will open the door, however you have to be on the trigger so you can only get through when you are close
here is the code : (yes i am terrible xd)
function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.F then
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
function onTouch(hit)
if hit.game.workspace.Name == "DoorKick" then
if onKeyPress().KeyCode == Enum.KeyCode.F then
script.Parent.Parent.DoorKick.Anchored = false
script.Parent.Parent.DoorKick.CanCollide = false
end
end
end
script.Parent.Touched:connect(onTouch)

1 comment