so I have this code that is suppose to give a badge when the word "/nuke" is said by me, but it doesnt work! Anyone know why?
admin = {"VipDanT"}
if admin.Chatted "/nuke" then local badgeservice = game:GetService("BadgeService") local badgeId = 2128480065 local Players = game:GetService("Players")
local function giveBadges(id) -- allows you to call giveBadges (with the ID as the first parameter) to give every player in the server a badge. for i, player in pairs(Players:GetPlayers()) do badgeservice:AwardBadge(player.UserId , id) end end giveBadges(badgeId)
end
I took a decent look at that script and it seemed like your attempt to call the "chatted" function was wrong. This is how I usually do it.
admin = {"VipDanT"} game.Players.PlayerAdded:Connect(function(plr) plr.Chatted:Connect(function(msg) if table.find(admin, plr.Name) then if msg == "/nuke" then local badgeservice = game:GetService("BadgeService") local badgeId = 2128480065 local Players = game:GetService("Players") local function giveBadges(id) for i, player in pairs(Players:GetPlayers()) do badgeservice:AwardBadge(player.UserId , id) end end giveBadges(badgeId) end end end) end)
That was the only error I could see in your script. Hopefully this one works out for you!