Hello. I have an airplane game, and I had the entire system in a local script. Unfortunately, it was only client side, so only Player 1 could see that they shoot down Player 2.
I copy pasted the entire code into a SCRIPT not a LOCAL SCRIPT. However, it is being difficult. Here is a screenshot.
local plane = script.Parent.Parent.Parent.Parent.Parent
local scripty = plane:FindFirstChild("Kar")
repeat
local scripty = plane:FindFirstChild("Kar")
wait()
print("Steel Inquisitor is searching for the script.")
until scripty
scripty.Disabled = false
Filled with Steel Inquisitor
Version #2
WaitForChild
local plane = script.Parent.Parent.Parent.Parent.Parent
local scripty = plane:WaitForChild("Kar")
scripty.Disabled = false
Version #2 should work fine. If you do want to have the repeat loop with the printing. Then maybe something like this:
local plane = script.Parent.Parent.Parent.Parent.Parent
if not plane:FindFirstChild("Kar") then
repeat
wait()
print("Steel Inquisitor is searching for the script.")
until plane:FindFirstChild("Kar")
end
scripty.Disabled = false
“Kar” appears to be a script, not local script. A local script won’t be able to find it. A regular script should. Have you checked, while the game is playing, that Kar is still visible on the server?
I changed every local script to a regular script so it could find oher scripts. However I am a bit confused. Can LocalScripts only find other LocalScripts?
And I have an error. Infinite Yield possible on "Wait for child “Kar”
One more thing. Printing "Steel Inquisitor is searching for the script." so many times every wait() is bad. (Also use task.wait()) Maybe you should make a function and get the function to just wait before printing. Maybe using a debounce.
local Debounce = false
function PrintSearching()
if Debounce == false then
Debounce = true
print("Steel Inquisitor is searching for the script.")
ask.wait(1)
Debounce = false
end
end
then use a coroutine and wrap the function so it doesn’t stop the repeat.
repeat
task.wait()
coroutine.wrap(PrintSearching)()
end