Script having trouble finding object inside of a player's character

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Accessing objects that for some reason can’t be found
  2. What is the issue? Include screenshots / videos if possible!
    The script cannot find the object in question, and responding nil as it can’t be found, the script is connected to a part that checks whether a player is touching it or not
    Code That is responding nil
local part = script.Parent
local Players = game:GetService("Players")
local humanoid = nil
local ff
local iframe
local char = nil

script.Parent.Touched:Connect(function(hit)
	if hit and hit.Parent:FindFirstChild("Humanoid") then 
		humanoid = hit.Parent.Humanoid
		char = hit.Parent
		ff = hit.Parent:FindFirstChild("iframe")
		print(ff)
		iframe = char:WaitForChild("iframe")
		iframe:Destroy()
	end
end)

Script creating the Instance of forcefield

print("1")
player = game.Players.LocalPlayer
Storage = game:GetService("ReplicatedStorage") -- useless for now
local FF = Instance.new("ForceField")
local Defense = Instance.new("NumberValue")
local Blocking = Instance.new("BoolValue")
local Stun = Instance.new("BoolValue")


player.CharacterAdded:Connect(function(character)
	print("Hope")
	FF.Visible = true
	FF.Parent = character
	FF.Name = "Test"
	Stun.Parent	= player
	Stun.Name = "Stun"
	Defense.Parent = player
	Defense.Name = "Defense"
	Defense.Parent:WaitForChild("Defense")
	Blocking.Parent = player
	Blocking.Name = "Blocking"
	Blocking.Parent:WaitForChild("Blocking")
	
end)

Proof of object being inside of Workspace—> Whokilledrobo
Issue
Issue’s Error response in console

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried other types of objects, in players rather than in Workspace–>PlayerCharacter but all it does is cause the same issue. The object can’t be found and isn’t able to get changed for that reason.

I’m rather new to scripting, and with the fact that I couldn’t find how this was having issues on the developer hub I hope this error just is easy to bypass

A bit of a more direct way on how the error works as it says “Object cannot be found” instead of returning nil

local part = script.Parent
local Players = game:GetService("Players")
local humanoid = nil
local ff
local iframe
local char = nil

script.Parent.Touched:Connect(function(hit)
	if hit and hit.Parent:FindFirstChild("Humanoid") then 
		humanoid = hit.Parent.Humanoid
		char = hit.Parent
		ff = hit.Parent.Part
		print(ff.name)
		iframe = char:WaitForChild("Test")
		iframe:Destroy()
	end
end)

I don’t understand why, but it is able to find normal objects inside of the character, but just not newly added objects.

The problem is you are parenting the “iframe” with a local script, so the server won’t register the change. You need to use a remote event to change it on the server side.