Advertisement
aiden50_70

choose server remade

Feb 7th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. --created by tollepuxis
  2. local folder = game.ReplicatedStorage.Classes
  3. local class1 = folder.Class1:Clone() --clone class1
  4. local class2 = folder.Class2:Clone() --clone class2
  5.  
  6. function IsAFolder(obj) -- checks if the object (obj) is a folder and returns a bool
  7. if obj:IsA("Folder") then
  8. return true
  9. else
  10. return fasle
  11. end
  12. end
  13.  
  14. function RemoveToolsFromFolder(folder,newparent) -- removes any tool instance from the folder into a new parent
  15. if IsAFolder(folder)==true then
  16. for _,tool in pairs(folder:GetChildren()) do
  17. if tool:IsA("Tool") or tool:IsA("HopperBin") then
  18. tool.Parent = newparent
  19. end
  20.  
  21. end
  22. else
  23. return
  24. end
  25.  
  26. end
  27.  
  28. function SelectClass(plr,class)
  29. if plr then
  30. if class=="class1" then
  31. new = class1:Clone()
  32. if IsAFolder(new) then
  33. RemoveToolsFromFolder(new,plr.Backpack)
  34. else
  35. new.Parent = plr.Character
  36. end
  37. elseif class=="class2" then
  38. new = class2:Clone()
  39. if IsAFolder(new) then
  40. RemoveToolsFromFolder(new,plr.Backpack)
  41. else
  42. new.Parent = plr.Character
  43. end
  44.  
  45. end
  46.  
  47. end
  48.  
  49. end
  50.  
  51. game.ReplicatedStorage.RemoteFunction.OnServerInvoke = SelectClass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement