Hello, currently making a “luck” based game. Basically one of thoughs games where you have a chance to win a small amount of robux. For losing you get a badge called “Better luck next time” and for winning the highest amount you also get a badge. I have tried many ways of getting this to work, but none have worked. I am currently stuck at this, which is a script within ServerScriptService.
local Players = game:GetService("Players")
local badgeService = game:GetService("BadgeService")
Players.PlayerAdded:Connect(function(player)
local l = player.PlayerGui:WaitForChild("ScreenGui").RewardFrame.Reward
local playerName = player.Name
print(l.Text)
if l.Text == "Congratulations, "..playerName.." You won 1,000 Robux! DM hryg on Discord to claim! Please send a screenshot as proof!" then
local badgeId = 2148268031 -- ID of the "1,000 Robux Winner" badge
badgeService:AwardBadge(player.UserId, badgeId)
end
if l.Text == "Hey, "..playerName.." We're sorry but you didn't win anything this time! Feel free to try again!" then
local badgeId = 2148267957 -- ID of the "No Prize" badge
badgeService:AwardBadge(player.UserId, badgeId)
end
end)
I appreciate any form of help you can give!