So, I’ve been making a shooting game with my friend recently, but I’m stuck at the tab leaderboard. Like you know? Phantom forces and arsenal has that leaderboard. A GUI which is only visible when you hold tab (Enum.KeyCode.Tab).
There are multiple posts on this topic. I’ve tried all of them but I’ve still not came up to a solution. It’d be great if anybody could help! Thanks!
It could be an issue with how you set up the code and or the script. Make sure you use UserInputService in a localscript and make sure it is placed somewhere that allows localscripts to run, in your case, probably inside of the leaderboard screengui
Well that’s weird. Somehow it worked even though I did the exact same thing in the main game. Might’ve been a studio bug (Even though I restarted it multiple times), or my script was messed up who knows? Anyways, thanks a lot for the help!
For anybody who wants to know the code, here it is:
(Please don’t care about the messy code)
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
local u = game:GetService("UserInputService")
local g = script.Parent
u.InputBegan:Connect(function(input, typing)
if typing then return end
if input.KeyCode == Enum.KeyCode.Tab then
g.Visible = true
end
end)
u.InputEnded:Connect(function(input, typing)
if typing then return end
if input.KeyCode == Enum.KeyCode.Tab then
g.Visible = false
end
end)