Hello, I'm making a 2D game on Roblox. I have it so when you press W on the keyboard the collisions for the trusses are turned on, however, this only works on PCs or other keyboard enabled devices, can any one help me with this. Here is my code, I'm new to scripting so it'll probably look a bit messy.
local L = game.workspace.T1 local userInputService = game:GetService("UserInputService") userInputService.InputBegan:connect(function(inputObject) if inputObject.KeyCode == Enum.KeyCode.W and L.CanCollide == false then L.CanCollide = true end end) userInputService.InputBegan:connect(function(inputObject) if inputObject.KeyCode == Enum.KeyCode.Space and L.CanCollide == true then L.CanCollide = false end end) userInputService.InputBegan:connect(function(inputObject) if inputObject.KeyCode == Enum.KeyCode.Space and inputObject.KeyCode == Enum.KeyCode.W then L.CanCollide = true end end)