So, I have a mapchanger that I'm scripting, and for some reason my tools disappear when I try to equip them once I change the mode.
I have one script that initializes the modes, and handles new players
_G.mode = "" _G.modes = { rcl = {game.ServerStorage:WaitForChild("GPR"), game.ServerStorage:WaitForChild("PSTL")}, reapers = {game.ServerStorage:WaitForChild("Reaper-7")}, swords = {game.ServerStorage:WaitForChild("Sword")}, warc = {game.ServerStorage:WaitForChild("W17"), game.ServerStorage:WaitForChild("Y14")} } game.Players.PlayerAdded:connect(function(plyr) if _G.mode ~= "" then for i,v in pairs(_G.modes[_G.mode]) do v:Clone().Parent = plyr.StarterGear end wait(1) plyr:LoadCharacter() end end)
Then, in a module script, I set the mode like so, using a chat command:
commands.setmode = function(args, speaker) if #args == 1 then _G.mode = args[1] for i,v in pairs(game.Players:GetChildren()) do v.StarterGear:ClearAllChildren() for k,x in pairs(_G.modes[_G.mode]) do local clone = x:Clone() x.Parent = v.StarterGear end v:LoadCharacter() commands.error({"Mode changed to " .. args[1]}, v) end else commands.error({"Cannot have multiple modes"}, speaker) end end
I know I need to do some more checks in the second one, but when testing with valid modes the tools are parented to the StarterGear fine, yet when I try to equip them the handle is invisible/nonexistent and the tool doesn't work. Any help?