Trying to destroy forcefield once you go onto the playing team, but it isnt working

Trying to destroy forcefield once you go onto the playing team, but it isnt working.


Script that gives forcefield ^

wait(0.1)
local Playing = game.Teams.Playing
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local ForceField = player.Character.forcefield
		if player.Team == Playing then
			ForceField:Destroy()
		   end
		end)
	end)

Try this:

local Playing = game.Teams.Playing
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local ForceField = character:FindFirstChildOfClass("ForceField")
		if player.Team == Playing and ForceField then
			ForceField:Destroy()
		end
	end)
end)

I just tried it, it didn’t work sadly.
no errors though.

I forgot to add a video and some screen shots one second, i will add the script that makes the force field

omg im dealing with a million people at a time- ahhh! anyway, literally just turn the team spawn force field time property to 1.

Try adding prints and see where a print isn’t being shown in the output.

prints dont solve problems, they just show where the problem could be.

Yeah, that’s why I’m suggesting that. If you can minimize the choices on where the problem can be, solving it would be easier.

however prints show where the problem can be. there could be multiple problems after the last print, also the print doesnt show the problems.

True

If a print doesn’t show up, you can infer where the problem(s) can be.

Try this :

wait(0.1)
local Playing = game.Teams.Playing
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
        player:GetPropertyChangedSignal("Team"):Connect(function()
			if player.Team == Playing then
				for _, item in pairs(player.Character:GetChildren()) do
					if item:IsA("ForceField") then
						item:Destroy()
					end
				end
			end
		end)
	end)
end)

Maybe put in playerscripts? I havent tested so might not work

Forcefield isnt appearing anymore

I’ve fixed the problem by looping the scripting and re scripting it to be client sided inside player scripts, but it keeps cloning but i cant figure out any way to fix it, any suggestions?