Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --created by tollepuxis
- local folder = game.ReplicatedStorage.Classes
- local class1 = folder.Class1:Clone() --clone class1
- local class2 = folder.Class2:Clone() --clone class2
- function IsAFolder(obj) -- checks if the object (obj) is a folder and returns a bool
- if obj:IsA("Folder") then
- return true
- else
- return fasle
- end
- end
- function RemoveToolsFromFolder(folder,newparent) -- removes any tool instance from the folder into a new parent
- if IsAFolder(folder)==true then
- for _,tool in pairs(folder:GetChildren()) do
- if tool:IsA("Tool") or tool:IsA("HopperBin") then
- tool.Parent = newparent
- end
- end
- else
- return
- end
- end
- function SelectClass(plr,class)
- if plr then
- if class=="class1" then
- new = class1:Clone()
- if IsAFolder(new) then
- RemoveToolsFromFolder(new,plr.Backpack)
- else
- new.Parent = plr.Character
- end
- elseif class=="class2" then
- new = class2:Clone()
- if IsAFolder(new) then
- RemoveToolsFromFolder(new,plr.Backpack)
- else
- new.Parent = plr.Character
- end
- end
- end
- end
- game.ReplicatedStorage.RemoteFunction.OnServerInvoke = SelectClass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement