Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

This script would work but then stops working after resetting character?

Asked by
KeIIin 5
7 years ago
Edited 7 years ago

Basically, this script would give each individual team their weapons that are located in ServerStorage in folders. After launching the game, the script would work and everyone has their weapons. Then once 10 minutes has passed by, it would stop working.



--Chaos Insurgency game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) if player.TeamColor == game.Teams["Chaos Insurgency"].TeamColor then local get = player:GetRankInGroup(2755639) if get >= 35 then local tool = game.ServerStorage["Insurgent+"]:GetChildren() for i,v in ipairs(tool) do v:Clone() v.Parent = player.Backpack end end end end) end) --Security Division game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) if player.TeamColor ==game.Teams["Security Department"].TeamColor then local get = player:GetRankInGroup(2710912) if get >= 40 then local tool = game.ServerStorage["SD Weapons"]:GetChildren() for i,v in ipairs(tool) do v:Clone() v.Parent = player.Backpack end end end end) end) --Mobile Task Force, Alpha-1 game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) if player.TeamColor ==game.Teams["Mobile Task Force"].TeamColor then local get = player:GetRankInGroup(2710915) if get == 60 then local tool = game.ServerStorage["Alpha-1"]:GetChildren() for i,v in ipairs(tool) do v:Clone() v.Parent = player.Backpack end end end end) end) --Mobile Task Force, Beta-7 game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) if player.TeamColor ==game.Teams["Mobile Task Force"].TeamColor then local get = player:GetRankInGroup(2710915) if get == 50 then local tool = game.ServerStorage["Beta-7"]:GetChildren() for i,v in ipairs(tool) do v:Clone() v.Parent = player.Backpack end end end end) end) --Mobile Task Force, Nu-7 game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) if player.TeamColor ==game.Teams["Mobile Task Force"].TeamColor then local get = player:GetRankInGroup(2710915) if get == 40 then local tool = game.ServerStorage["Nu-7"]:GetChildren() for i,v in ipairs(tool) do v:Clone() v.Parent = player.Backpack end end end end) end) --Mobile Task Force, E-11 game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) if player.TeamColor ==game.Teams["Mobile Task Force"].TeamColor then local get = player:GetRankInGroup(2710915) if get == 55 then local tool = game.ServerStorage["E-11"]:GetChildren() for i,v in ipairs(tool) do v:Clone() v.Parent = player.Backpack end end end end) end) --Medical Division game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) if player.TeamColor ==game.Teams["Medical Department"].TeamColor then local get = player:GetRankInGroup(2715382) if get >= 35 then local tool = game.ServerStorage["Needles"]:GetChildren() for i,v in ipairs(tool) do v:Clone() v.Parent = player.Backpack end end end end) end) --Rapid Response Team game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) if player.TeamColor ==game.Teams["Internal Security Department"].TeamColor then local get = player:GetRankInGroup(2715475) if get == 10 then local tool = game.ServerStorage["RRT Weapons"]:GetChildren() for i,v in ipairs(tool) do v:Clone() v.Parent = player.Backpack end end end end) end) --Mobile Task Force, Task Force Leader game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) if player.TeamColor ==game.Teams["Mobile Task Force"].TeamColor then local get = player:GetRankInGroup(2710915) if get >= 65 then local tool = game.ServerStorage["TFL"]:GetChildren() for i,v in ipairs(tool) do v:Clone() v.Parent = player.Backpack end end end end) end)

1 answer

Log in to vote
0
Answered by 7 years ago

Right away I think I see the problem.

You aren't cloning the tool stuff to the player's backpack...

v:Clone()
v.Parent = player.Backpack

You make a clone of v, but then instead of parenting the clone you are parenting v (the thing you made a clone of) so once you do this one time you can't do it again as in the future there is nothing there for it to clone. A simple solution would be:

v:Clone().Parent = player.Backpack
Ad

Answer this question