Infinite yield possible on

the part inside model the inside folder that go to workspace sometimes.

local RS = game:GetService("ReplicatedStorage")
local Plrs = game:GetService("Players")

local RE = RS:WaitForChild("FirstQuest")
local Plr = Plrs.LocalPlayer
local Pat = workspace:WaitForChild("HalloweenDropper").StuffAtHalloweenLobby.HalloweenDropperDone

Pat.Touched:Connect(function(Hit)
	local Target = Hit.Parent
	local TouchedPlr = Plrs:GetPlayerFromCharacter(Target)

	if TouchedPlr and TouchedPlr == Plr then
		RE:FireServer() -- This will send a request from the client to the server 
	end
end)

folder on server storage.

Infinite yield means that the script is :WaitForChild("") on something that doesnt exist. Check if the item you’re waiting for matches the name.

2 Likes

You could also try :FindFirstChild().

What you want to do is place a debounce on it, I’m on a mobile rn so I can’t rewrite it but see what you can do.

Where does the error occur? What does it say (provide the entire error message)? You aren’t providing enough information for us to help very much.

RS = game:GetService("ReplicatedStorage")
Players = game:GetService("Players")

RE = RS:FindFirstChild("FirstQuest")

Pat = workspace:FindFirstChild("HalloweenDropper").StuffAtHalloweenLobby.HalloweenDropperDone

Pat.Touched:Connect(function(hit)
local Target = hit.Parent:FindFirstChild("Humanoid") -- Should Detect the Player
if Target then
RE:FireServer() -- Assuming you have the Player Variable in the RemoteEvent, should run on the Player
end
end)

If it says
Attempt to index nil with "Variable"
It might mean that the specific Instance doesnt exist for the script cant find it.

its the same name
[max carrrrr]

dont work
[max charrrrrrrrrrrr]

its just to detected the part for touch event

Infinite yield possible on on the part

its not that its just Infinite yield possible on on the part

Which line is the error on, and are you able to send a screenshot of the output?

wait a min i will send
[max charr]

image
Well i need to wait for the errror to happer but here is the line

Is the object “HalloweenDropper” already in workspace?

1 Like

nope its in the serverstorage insdie a folder

If you don’t have an instance named “HalloweenDropper” in workspace

local pat = workspace:WaitForChild("HalloweenDropper").StuffAtHalloweenLobby.HalloweenDropperDone

won’t stop searching for “HalloweenDropper” in workspace and will stop the script. If you want it to timeout after a period of time, try

WaitForChild("HalloweenDropper", 3) -- Will timeout after 3 seconds

If you want to search for “HalloweenDropper” in the folder, consider changing workspace to the name of the folder.

maybe there is another way to fix it?

The thing you’re searching for, is it in serverstorage in a folder?

yea, its inside there with some other maps and one of them go to workspace sometimes