The title kind of explains it all. I’m trying to make it so triggering a proximityPrompt gives you a badge. The following is my original script:
local badgeService = game:GetService("BadgeService")
local badgeId = 2125009630
script.Parent.Triggered:Connect(function(player)
if not badgeService:UserHasBadgeAsync(player.UserId, badgeId) then
badgeService:AwardBadge(badgeId)
end
end)
Thank you for replying! the badgeId part is used in local badgeId = 2125009630. It might be something I misunderstood while writing that. I’ve tried changing it to the badge id, but it still doesn’t award it
local Player = game.Players.LocalPlayer
local ProximityPrompt = game.Workspace.Part.ProximityPrompt
local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")
ProximityPrompt.Triggered:Connect(function()
RemoteEvent:FireServer()
print("Work")
end)
Script in ServerScriptService
local BadgeService = game:GetService("BadgeService")
local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local Badge = (2125009630)
RemoteEvent.OnServerEvent:Connect(function(Player)
if not BadgeService:UserHasBadgeAsync(Player.UserId, Badge) then
BadgeService:AwardBadge(Player.UserId, Badge)
print("Working!")
end
end)