uis = game:GetService("UserInputService") uis.InputBegan:Connect(function(key) if key.KeyCode == Enum.KeyCode.Period then print("something") end end)
The problem is the dot is already a key to turn right, So it won't do anything, Try this
local contextActionService = game:GetService("ContextActionService") function onPressed() print("Pressed!") end contextActionService:BindAction("print", onPressed, false, Enum.KeyCode.Period)
Also put it in StarterGui
The reason why your script wasn't working is the dot is already a bind action to turn right with userinputservice it can't overwrite the action, So with ContextActionService we are overwriting the bind action of the dot so it will work, Also turn it to true if you want to make a mobile button of it.