I made multiple scripts and really thought it worked but when I published the newest update, I realized it didn’t work at all. So essentially you talk to this NPC and in the script, it checks if you picked a certain choice and also checks to see if you have the badges it is looking for. If it does then it gives you the badge. But, it only seems to check the first badge and gives you the badge regardless if you have any of the other badges. I’ll include my script for better explanation.
local dialog = workspace.noobernoob.Head.Dialog
local plr = game:GetService("Players").LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local hop = 2141550464
local jump = 2142104326
local wrap = 2142118989
local function onSelected(player, choice)
if choice == dialog.InitalGreeting.StickThemUp.DidIDo.Secrets.Practice.PracticePro then
if game:GetService("BadgeService"):UserHasBadgeAsync(player.UserId,jump,wrap,hop) then
wait(2)
game.ReplicatedStorage.BadgeGet4:FireServer()
else
game.ReplicatedStorage.Noob:FireServer()
end
end
end
dialog.DialogChoiceSelected:Connect(onSelected)
This is a local script in StarterPlayerScripts that checks if you clicked a certain dialogue, checks to see if you have the badges and then fires another script via remote event to give you the badge. But, alas. Doesn’t work.
game.ReplicatedStorage.BadgeGet4.OnServerEvent:Connect(function(player)
game:GetService("BadgeService"):AwardBadge(player.UserId,2142701032)
game.ReplicatedStorage.SendChatEvent8:FireAllClients(player.Name.. " has been deemed a practice pro.")
end)
This is the script in serverscriptservice that fires the remote event to give you the badge if you have the other badges. Also, I tried holding the badges in an array/table to see if that would work as well but it failed to work. Example:
local BadgeIDsNeeded = {
2141550464,
2142104326,
2142118989,
}
game:GetService("BadgeService"):UserHasBadgeAsync(player.UserId,BadgeIDsNeeded) then
Is there another way to approach this to where it actually works?
I have got all the badges before but I also had tested before I got certain badges to check if everything was working the way it was supposed to. Which it appeared to be, until I had launched the game and a player that I knew didn’t have all the necessary badges had gotten to an area that required all the badges. That’s why I’m a mixture of confused and rethinking that my script has to be faulty in a sense.
maybe because the line u put that requires all badge before entering is actually only checking if the player have atleast 1 of the badge u put, im not familiar with how badges works, but i think this line
if game:GetService("BadgeService"):UserHasBadgeAsync(player.UserId,jump,wrap,hop) then
dont have 3rd, 4th and 5th arguments, just first argument (player) and second argument (the badge)
maybe its only just if the player have jump badge and its letting them pass through because wrap and hop is in argument that dont exist (just my guess)
if game:GetService("BadgeService"):UserHasBadgeAsync(player.UserId,jump,wrap,hop) then
With this part try getting rid of wrap and hop and put each of them into another line so maybe do like
if game:GetService("BadgeService"):UserHasBadgeAsync(player.UserId,jump) and game:GetService("BadgeService"):UserHasBadgeAsync(player.UserId,wrap) and game:GetService("BadgeService"):UserHasBadgeAsync(player.UserId,hop) then
I don’t know if this is right but see what happens
That’s what I was thinking as well to be honest. And I had attempted to put it in an array/table but doing that didn’t work at all. Ugh honestly idk now.
local BS = game:GetService("BadgeService")
local BadgeIDsNeeded = {
2141550464,
2142104326,
2142118989,
}
local function CheckBadge(Plr)
local HaveAll = true
for _, v in pairs(BadgeIDsNeeded) do
if not BS:UserHasBadgeAsync(Plr.UserId, v) then
HaveAll = false
break
end
end
if HaveAll == true then
--idk
end
end)