I am trying to make a char command that goes like /char (players display name) (model name) All the models are in the script but I am trying to get it to detect the models name in message and then turn the player into that model The script so far is this but I am stuck on it I do not know if any is wrong but I do not know where to go from here any help in this would be very helpful
local characters = game.ServerScriptService.AdminCmds
local commands = {}
local prefix = "/"
local function findPlayer(name)
for i, player in pairs (game.Players:GetPlayers()) do
if string.lower(player.)
end
end
local function findModel(name)
local Model = (characters:GetChildren())
local oldCharacter = player.Character
local newCharacter = Model.
end
commands.SetPlayerModel = function(sender, arguments) -- sender: Obeject / arguments
end
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message, recipient)
message = string.lower(message)
local splitString = message:split(" ") -- ("/SetPlayerModel","username","character")
local slashCommand = splitString[1] -- "/SetPlayerModel"
local cmd = slashCommand:split(prefix) -- {"/","SetPlayerModel"}
local cmdName = cmd[2]
if commands[cmdName] then
local arguments = {} -- Contain the next split parts of the message (e.g player name, Model name)
for i = 2,#splitString, 1 do
table.insert(arguments,splitString[i])
end
commands[cmdName](player) --Fired our SetPlayerModel
end
end)
end)

2 comments
Line 9 ain't a full if statement. Line 16 isn't gonna work like that. There is a few mistakes here
I know I was trying to make it work with characters in my game so they turn into any chracterso I didn't complete it.