Code;

local event = Instance.new("RemoteEvent")
event.Parent = game.ReplicatedStorage
event.Name = "RCL"
event.OnServerEvent:connect(function()
		local gunsadded = false
		local bricktops = game.ReplicatedStorage.Maps.Bricktops
		for i,v in ipairs(game.Players:GetChildren()) do
		v.CharacterAdded:connect(function(character)
		if v.TeamColor == BrickColor.new("Bright red") or v.TeamColor == BrickColor.new("Bright blue") then 
			if bricktops:IsDescendantOf(workspace.CurrentMap) then
			for i,x in ipairs(WeaponStorage.RCLWeapons:GetChildren()) do
				if not gunsadded then
				gunsadded = true
				if x:IsA("Tool") then
					x:Clone().Parent = v.Backpack
						       gunsadded = false
							end
						end
					end
				end
			end
		end)
end

Purpose;

The event gets all the players in the game, and checks if they're on either the Bright blue or Bright red team, and checks whether "Bricktops" is present within workspace.CurrentMap. If the players are on the blue and red teams and Bricktops is present, then it gives the players weapons every time they respawn.

Idea of what the problem is;

if bricktops:IsDescendantOf(workspace.CurrentMap) then

Notes;

RemoteEvent is fired in another script when a TextButton is clicked.

Everything was running somewhat smoothly last night until I added :IsDescendantOf

2 comments

0

Maybe it's because of how you defined brick tops. You defined bricktops as being in replicated storage. You might have to look for a sting value in IsDecendantOf function. I'm not really sure though.

0

Well, Bricktops/other maps are in game.ReplicatedStorage.Maps and it is moved to game.Workspace.CurrentMaps when it is loaded by a different RemoteEvent being fired.