I'm trying to make a script where once the player presses K on their keyboard, the script checks if they have a badge. If they do, they teleport to a specific place. If they dont, it does nothing except print out a message, but for some reason its not working. Any help? I might be doing something wrong here
local players = game.Players.LocalPlayer
local BadgeService = game:GetService("BadgeService")
local BadgeId = 2124514373
local mouse = players:GetMouse()
mouse.KeyDown:Connect(function(Key)
if Key == "k" then
game:GetService("Players").PlayerAdded:Connect(function(player)
if BadgeService:UserHasBadge(player.UserId, BadgeId) then
local PlaceId = 4767501208
game:GetService("TeleportService"):Teleport(PlaceId, players.Character)
print("I hopefully worked")
else
wait(0.1)
print("I am a silly goof and don't have the badge")
end
end)
end
end)
