Chat Command Scripting Help

Hey everyone! :wave:

I’m currently trying to make a “!removejetski” command, where when said by a specific rank+ in my group, it’ll find all of the Models named “Jetski” under Workspace and Destroy them. Does anyone know how to do this and is willing to provide assistance with how to do so?

I know this isn’t the place to ask for scripts, but I’ve searched for hours and haven’t found anything.

Thank you in advance for your assistance! :heart:

2 Likes

Search devforum before asking.

Here is the script.

local GroupId = 1234567890
local MinimumRankToUseCommand = 1234567890 --for the number of the rank

game.Players.PlayerAdded:Connect(function(Player)
	if Player:GetRankInGroup(GroupId) >= MinimumRankToUseCommand then
		Player.Chatted:Connect(function(Message)
			if Message == "!removejetski" then
				game.Workspace.Jetski:Destroy()
			end
		end)
	end
end)
1 Like

Thank youuuuuuuuuuuuuuuuuuuuuu!

1 Like

This only removes one of them.

local GroupId = 0 --Your group id here
local MinimumRankToUseCommand = 0 --Id of the rank you want here

game.Players.PlayerAdded:Connect(function(Player)
	if Player:GetRankInGroup(GroupId) >= MinimumRankToUseCommand then
		Player.Chatted:Connect(function(Message)
			if Message == "!removejetski" then
				for _, jetskies in pairs(game.Workspace:GetChildren()) do
                    if jetskies.Name == "Jetski" then
                        jetskies:Destroy()
                    end
                end
			end
		end)
	end
end)
1 Like

This script will get all the elements in the Workspace and if the name is “Jetski” it will destroy it.

1 Like

Thank you! (30 ch.rsssssssssss)

1 Like