Advertisement
GoodManUsernameGood

Untitled

Feb 13th, 2022
789
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. local speciesAllowed = {}
  2.  
  3. speciesAllowed["husk"] = true
  4. speciesAllowed["yourOtherSpeciesHere"] = true
  5.  
  6. Hook.Add("chatMessage","controlhuskcommand",function(msg, client)
  7.     if msg == "!controlhusk" then
  8.         if client.Character ~= nil then
  9.             if not client.Character.IsDead then
  10.                 return true
  11.             end
  12.         end
  13.         if not client.InGame then
  14.             return true
  15.         end
  16.  
  17.         local chars = Character.CharacterList
  18.         local suitablechars = {}
  19.         for i = 1, #chars, 1 do
  20.             local charat = chars[i]
  21.             if not charat.IsDead and speciesAllowed[charat.SpeciesName] and not charat.IsRemotelyControlled then
  22.                 table.insert(suitablechars, charat)
  23.             end
  24.         end
  25.  
  26.         if #suitablechars >= 1 then
  27.             Player.SetClientCharacter(client, suitablechars[Random.Range(1, #suitablechars)])
  28.         end
  29.  
  30.         return true -- hide message
  31.     end
  32. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement