You can write your topic however you want, but you need to answer these questions:
I want the script to search through each of the npcs until it finds the billboard gui
2. What is the issue? Include screenshots / videos if possible!
It keeps returning this everytime I play the script
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried everything up to looking for solutions on the dev hub, as well as looking into it. I’m not sure what else I can do.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
I am working on a “service” system that randomly assigns a billboard GUI to different npcs by assigning it into a NPCs head by random.
As you take orders. This script in particular keeps track of how long it takes, and if the player takes too long, it’s supposed to edit the billboard GUI image into a different one.
In this case, I’m trying to figure out which NPC the Billboard GUI is in by looping through the table until I find it inside one of the NPCs heads, but it keeps returning the same line.
local rs = game:GetService("ReplicatedStorage")
local food = rs.ProximityPrompt.foodtype
local ss = game:GetService("ServerScriptService")
rs.timer.OnClientEvent:Connect(function(plr)
print("script ran")
if rs.orderfinished.Value == false then repeat
task.wait(1)
rs.time.Value = rs.time.Value + 1
until rs.orderfinished.Value == true or rs.time.Value >= 10
else
rs.orderfinished.Value = false
print("failed")
end
if rs.time.Value >= 10 then
local index = {
workspace.INDEX.testing.Head,
workspace.INDEX.testing2.Head,
workspace.INDEX.testing3.Head,
workspace.INDEX.testing4.Head,
workspace.INDEX.testing5.Head,
}
for indexcount = 1, #index do
local whichperson = index[indexcount]
for i, v in index do
whichperson.BillboardGui.cloud.Image = "rbxassetid://100916423533536"
end
end
task.wait(10)
--fancy text here
rs.time.Value = 0
script.Parent.Parent.Parent.Head.BillboardGui:Destroy()
rs.sometyhing:FireAllClients()
rs.gamestart:FireAllClients()
rs.orderfinished.Value = true
script.Parent:Destroy()
else if rs.orderfinished.Value == true then
script.Parent.Enabled = false
rs.orderfinished.Value = false
if plr:FindFirstChild("Backpack") and plr.Backpack:FindFirstChild(food) then
plr.Backpack[food]:Destroy()
script.Parent.Parent.Parent.Head.BillboardGui:Destroy()
rs.sometyhing:FireAllClients()
rs.gamestart:FireAllClients()
rs.orderfinished.Value = true
script.Parent:Destroy()
end
print("time left")
end
end
end)
-- this is unrelated
rs.sometyhing.OnClientEvent:Connect(function()
game.Workspace:WaitForChild("testbrick").ProximityPrompt.Enabled = true
end)
end)
Any help is appreciated! Thank you so much for your time. ^^