THE REASON IS BECAUSE LOCALSCRIPTS CANNOT ACCESS OTHER'S PLAYERGUIS.
I made a 'fusion' script for a tool I'm working on and it checks a player's PlayerGui for a specific GUI first. However, the output tells me there's an 'infinite yield possible' even though I'm 100% certain the PlayerGui is there. Here is the script:
local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
tool.Equipped:connect(function(mouse)
mouse.Button1Down:connect(function()
local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 300)
local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
local beam = Instance.new("Part", workspace)
beam.Material = "Neon"
beam.Transparency = 1
beam.Anchored = true
beam.Locked = true
beam.CanCollide = false
local distance = (tool.Handle.CFrame.p - position).magnitude
beam.Size = Vector3.new(0.2, 0.2, distance)
beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
game:GetService("Debris"):AddItem(beam, 0.1)
if part then
local humanoid = part.Parent:FindFirstChild("Humanoid")
if not humanoid then
humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
end
if humanoid then
if humanoid.Parent:FindFirstChild("FSTORM") then
if game.Players[humanoid.Parent.Name]:WaitForChild("PlayerGui"):FindFirstChild("FuseGui") == nil then
local gu = script.FuseGui:Clone()
gu.Parent = game.Players[humanoid.Parent.Name].PlayerGui
gu.Frame.Title.Text = player.Name .. " wants to fuse with you."
local st = Instance.new("StringValue")
st.Name = "Fuser"
st.Value = game.Players.LocalPlayer.Name
st.Parent = gu.Frame
end
end
end
end
end)
end)
It's line 32 that's the problem. Please help.

6 comments
Now it just does nothing; no effect or error in output :/
Just realized I had a typo. xD Sorry. It should be ~= instead of ==
Hm, still no effect. Strange.
Also, it's supposed to be '==' because it's checking if the gui is there or not.
no it's supposed to be ~= xD Trust me. ~= is not equal to
You don't want it to be nil so we are checking that it's not nil. If you do use == it will wait until until that object is nil then stop repeating