#Anyone know what's up with my script?
1 messages · Page 1 of 1 (latest)
ok
The 5-second delay you are experiencing is the smoking gun here. It is coming directly from: local locationPart = game.Workspace.JobLocations:WaitForChild(jobName, 5) Because you added a 5-second timeout, the server halts right there, searches for 5 seconds, Try this new script i made
Will do, thank you
Thats what i do Have a good day🙂
Ok
Replace your "isPlayerInJobLocation" function with this updated
local function isPlayerInJobLocation(plr, jobName)
print("[Server Check] Looking for job location: '" .. tostring(jobName) .. "'")
local jobLocationsFolder = game.Workspace:FindFirstChild("JobLocations")
if not jobLocationsFolder then
warn("[Server Error] The folder 'JobLocations' does not exist on the Server!")
return false
end
-- THE ULTIMATE DEBUG LOOP: What does the server actually see?
print("--- SERVER SEES THESE PARTS IN JOB LOCATIONS ---")
for _, child in pairs(jobLocationsFolder:GetChildren()) do
print("Found child named: '" .. child.Name .. "'")
end
print("----------------------------------------------")
local locationPart = jobLocationsFolder:WaitForChild(jobName, 5)
if not locationPart then
warn("[Server Error] Timed out waiting for part: '" .. tostring(jobName) .. "'.")
return false
end
local char = plr.Character
if not char or not char:FindFirstChild("HumanoidRootPart") then return false end
local charPos = char.HumanoidRootPart.Position
local partPos = locationPart.Position
local partSize = locationPart.Size
local buffer = 20
return math.abs(charPos.X - partPos.X) <= partSize.X/2 + buffer and
math.abs(charPos.Y - partPos.Y) <= partSize.Y/2 + buffer and
math.abs(charPos.Z - partPos.Z) <= partSize.Z/2 + buffer
end
alright
When you trigger the job and check your Output window, look at the list of names it prints out. Does "Fishaloni's" show up in that list exactly as expected, or is it missing/spelled differently?
Can you show me the Output not the dev console?
The server thinks the folder is empty
It's not though
The code is actually working perfectly. It's just exposing the real issue: The server literally cannot see your part
Ok
Do you have two folders named JobLocations? If you accidentally have a second, empty folder named JobLocations sitting somewhere in your Workspace, the server might be looking inside the wrong one.
No, only one
Ok
I don't know what it means about this line of code local locationPart = game.Workspace.JobLocations:WaitForChild(jobName, 5) What is jobName
Wait now i know whats wrong
what is it
You did not make anything Named jobName in the folder maybe try to make a folder called jobName and put your parts in there
?? It's not checking for anything called jobname
local locationPart = game.Workspace.JobLocations:WaitForChild(jobName, 5)
jobName is a param given in isPlayerInJobLocation