I’ve been trying to write up a script that awards a player a boombox when a certain rank in the group or above types /boombox user, I’ve looked around the devforum and the devhub and thrown together something but it doesn’t work at all. No errors print in the console.
I’m probably overlooking something so basic but for the life of me I can’t figure it out, I’d appreciate any help.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local GroupId = 11951218
local MinimumRank = 253
local BadgeId = 2124808396
local BoomboxModel = game.ServerStorage:WaitForChild("Gears").BlackstoneBoombox
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(msg)
if Player:GetRankInGroup(GroupId) >= MinimumRank then
if msg:sub(1,7) == "/boombox " then
local PlayerToBeAwarded = game.Players:FindFirstChild(msg:sub(8))
if PlayerToBeAwarded then
game:GetService("BadgeService"):AwardBadge(PlayerToBeAwarded.UserId, BadgeId)
BoomboxModel:Clone().Parent = PlayerToBeAwarded.Backpack
end
end
end
end)
end)