-
What do you want to achieve? I’m trying to check if a player has a certain username, then make something happen once they press the P key if they do have a certain username.
-
What is the issue? The script is detecting if a player has the correct username, but is not detecting the pressing of the P key, and I don’t know what the problem is.
-
What solutions have you tried so far? I’ve looked on the developer forums and tried for a while to do it myself, but I haven’t been able to figure out the problem, and I’m not getting any errors in the output window.
Here is the code if you need it.
local TS = game:GetService("TeleportService")
local names = {"VisibleContrast"}
local UIS = game:GetService("UserInputService")
game.Players.PlayerAdded:Connect(function(player)
for i, v in pairs(names) do
if v == player.Name then
print(player.Name)
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.P then
print("Opening developer panel.")
end
end)
end
end
end)
I would appreciate any help I can get.