Custom Kit Command Help



game.Players.PlayerAdded:Connect(function(player)
	if player:GetRankInGroup(1) then
		player.Chatted:Connect(function(message)
			local split = message:split(" ")
			if split[1] == "/kit" then


			end
		end)
	end
end)

Hello, I need some help on this custom command for one of my new games,
I want to be able to make /kit and be able to have a cooldown OR block the user permanently from using /kit <TheKitTheyAlreadyUsed’sName> I tried adding the user to a datastore and checking if there in the datastore before allowing them to process the command but it dident work at all, Im new to scripting so any feedback or help would be nice!

You have to add something after the “GetRankInGroup(1)”

game.Players.PlayerAdded:Connect(function(player)
	if player:GetRankInGroup(groupidhere) > 1 then
		player.Chatted:Connect(function(message)
			local split = message:split(" ")
			if split[1] == "/kit" then


			end
		end)
	end
end)
1 Like

Thanks that also helps alot, im still facing my main problem though.

Here’s a little script I made.

local dss = game:GetService("DataStoreService")
local kitds1 = dss:GetDataStore("Kit1")

local function useKit(kit, player)
	local setSuccess1, errorMessage1 = pcall(function()
		kitds1:SetAsync(player.UserId, true)
	end)
	if not setSuccess1 then
		warn(errorMessage1)
	end
	
	--do stuff here
end

local function checkifOwns(kit, player)
	if kit == "kit1" then
		local getSuccess1, kit1Used = pcall(function()
			return kitds1:GetAsync(player.UserId)
		end)
		if getSuccess1 then
			if kit1Used ~= true then
				useKit(kit, player)
			end
		end
	end
end

game.Players.PlayerAdded:Connect(function(player)
	if player:GetRankInGroup(123456) > 1 then
		player.Chatted:Connect(function(message)
		local split = message:split(" ")
			if split[1] == "/kit" then
				checkifOwns(split[2], player)
			end
		end)
	end
end)
1 Like

Ooh Thanks man!
Helps a lot!