local player = game.Players.LocalPlayer
local BadgeService = game:GetService("BadgeService")
if BadgeService:UserHasBadgeAsync(player.UserId, 1111111) then
workspace.rooms.Basement.Donotgobeyond.SurfaceGui.TextLabel.Text = "u already have the badge lol"
wait(3)
workspace.W1.W2.WTEXT.SurfaceGui.TextLabel.Text = "the default text"
end
if not BadgeService:UserHasBadgeAsync(player.UserId, 1111111) then
game.Workspace.W.W1.W2.open.Enabled = true
wait(3)
game.Workspace.W.W1.W2.open.Enabled = false
end
Practically everything is a template to avoid leaking.
game.Players.Playeradded:Connect(function(player)
local BadgeService = game:GetService("BadgeService")
if BadgeService:UserHasBadgeAsync(player.UserId, 1111111) then
workspace.rooms.Basement.Donotgobeyond.SurfaceGui.TextLabel.Text = "u already have the badge lol"
wait(3)
workspace.W1.W2.WTEXT.SurfaceGui.TextLabel.Text = "the default text"
end
if not BadgeService:UserHasBadgeAsync(player.UserId, 1111111) then
game.Workspace.W.W1.W2.open.Enabled = true
wait(3)
game.Workspace.W.W1.W2.open.Enabled = false
end
end)
yeah use the event players.playeradded on a server script
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
print(player.UserId.. " joined the game!")
end)
Players.PlayerRemoving:Connect(function(player)
print(player.Name .. " left the game!")
end)
Use the desired Part’s Touched event. Make sure that whatever hits the Part actually came from the Player’s character. Make a debounce so that it doesn’t flicker.
local player = game.Players.LocalPlayer
local BadgeService = game:GetService("BadgeService")
local debounce = false
Type_The_Path_Of_The_Part_That_Will_Trigger_This_Function.Touched:Connect(function(Hit : BasePart)
if debounce then return end
local model = Hit:FindFirstChildWhichIsA("Model")
-- Check if the part that touched the (door?) is part of the player's character.
if not model or not (player.Character == model) then
return
end
debounce = true
if BadgeService:UserHasBadgeAsync(player.UserId, 1111111) then
workspace.rooms.Basement.Donotgobeyond.SurfaceGui.TextLabel.Text = "u already have the badge lol"
wait(3)
workspace.W1.W2.WTEXT.SurfaceGui.TextLabel.Text = "the default text"
else
game.Workspace.W.W1.W2.open.Enabled = true
wait(3)
game.Workspace.W.W1.W2.open.Enabled = false
end
debounce = false
end)