how do i fix this it wont work :(
local block = game.Workspace.Zednov:FindFirstChild("Purchases").SwordGen.SwordGenBlock
how do i fix this it wont work :(
local block = game.Workspace.Zednov:FindFirstChild("Purchases").SwordGen.SwordGenBlock
Might be of some use, the following code is a string based location checker, If the location is fine it will let you know otherwise it will print out where it failed at
function checkLocation(locString)
print("Checking ["..locString.."] Please wait!.....")
local LocTab = locString:split(".")
local Location = game
local Num = 1
_Test = (function(str)
local Success,Err = pcall(function() Location = Location[LocTab[Num]] end)
if(Success == true) then
Num = Num +1 if(Num <= #LocTab) then _Test(LocTab[Num]) end
else
error("Error: The location \n ["..locString.."] \nfailed at "..tostring(Location:GetFullName()).."."..LocTab[Num].." \n please check that the path to your object is correctly named and formated and try again!")
end
return Location
end)
_Test(LocTab[Num])
print("Done! \n Everything seems fine!")
return Location
end
--// your Location would look like this!...
local Check = "Workspace.Zednov.Purchases.SwordGen.SwordGenBlock"
local myLoc = checkLocation(Check)
print(myLoc)
Usage:
Either Change the String based Variable named Check to the path you need or change the function call named checkLocation(Check) Change The "Check" to the path/Location you want to check but keep the quotes ( " ) round your location.
Also the function only works with straight locations, so nothing like:
checkLocation("Workspace:FindFirstChild("Zednov").Purchases.SwordGen.SwordGenBlock")
-- or any other abbreviations/Variants, this will break the function!
The function will return the actual location as if you called it normally in roblox lua but will let you know what doesn't exist rather than just the line it failed on.
Hope this helps! :)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
did you spell everything right? Also sometimes the script runs too fast so you can do game.Workspace:WaitForChild("Zednov")