#Anyone know what's up with my script?

1 messages · Page 1 of 1 (latest)

carmine glade
#

i don't know

red horizon
rare matrix
#

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

red horizon
#

Will do, thank you

rare matrix
red horizon
#

Here's proof they exist

rare matrix
#

Hm ok give me a sec

#

Which kind of script is it?

red horizon
#

Server script

#

It's in serverscriptservice

rare matrix
#

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

red horizon
#

alright

rare matrix
#

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?

red horizon
rare matrix
#

Can you show me the Output not the dev console?

red horizon
rare matrix
#

The server thinks the folder is empty

red horizon
#

It's not though

rare matrix
#

I know

#

gimme 1 sec

red horizon
#

If you want I can ask my french friend

#

His name is mr c. laude

rare matrix
#

The code is actually working perfectly. It's just exposing the real issue: The server literally cannot see your part

red horizon
#

Well.. why not

#

I'll ask claudwe

rare matrix
#

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.

red horizon
#

No, only one

rare matrix
#

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

red horizon
#

what is it

rare matrix
#

You did not make anything Named jobName in the folder maybe try to make a folder called jobName and put your parts in there

red horizon
#

?? It's not checking for anything called jobname

rare matrix
#

local locationPart = game.Workspace.JobLocations:WaitForChild(jobName, 5)

red horizon
#

jobName is a param given in isPlayerInJobLocation

rare matrix
#

Oh

#

Sorry i don't know how to fix it i think your studio is broken or the project is broken