Where to put code in for a queue line system

Making a queue system, similiar to Universal Studios’ and I’m trying to figure out where I would put the script into:

function change (number,charactername)
local tag = script.Parent.Strings:FindFirstChild(“Queue”… number)
tag.Value = charactername
end

function move (character)
local moved = false
local availables = {}
local tags = script.Parent.Strings:GetChildren()
– check if the player is already waiting. If he is, move him to the next spot.
for i = 1,#tags do
if tags[i].Value == character.Name and i ~= 1 then
moved = true
character.Humanoid.WalkSpeed = 16
character.Humanoid:MoveTo(script.Parent:FindFirstChild(“WalkPart”…i - 1).Position)
wait(2)
character.Humanoid.WalkSpeed = 0
tags[i].Value = “None”
tags[i-1].Value = character.Name
end
end
– if the player wasn’t already waiting, move him to the latest spot.
if not moved then
for i = 1,#tags do
if tags[i].Value == “None” then
moved = true
character.Humanoid.WalkSpeed = 16
character.Humanoid:MoveTo(script.Parent:FindFirstChild(“WalkPart”…i).Position)
wait(2)
character.Humanoid.WalkSpeed = 0
tags[i].Value = character.Name
break
end
end
end
end

local chil = script.Parent.Strings:GetChildren()
for i = 1,#chil do
chil[i].Changed:connect(function()
–move(workspace:FindFirstChild(chil[i].Value))
end)
end

script.Parent.Trigger.Touched:connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) ~= nil then
hit.Parent.HumanoidRootPart.CFrame = CFrame.new(script.Parent.TpPart.Position + Vector3.new(0,3,0), script.Parent.LookToPart.Position)
hit.Parent.Humanoid.WalkSpeed = 0
move(hit.Parent)
end
end)

script.Parent.Trigger2.Touched:connect(function(hit)
script.Parent.Strings.Queue1.Value = “None”
if hit.Parent.Humanoid ~= nil then
local tags2 = script.Parent.Strings:GetChildren()
for i = 1, #tags2 do
if tags2[i].Value ~= nil then
move(workspace:FindFirstChild(tags2[i].Value))
end
end
end
end)

I also have 10 strings, one for each queue, inside a folder. (Queue1, Queue2, etc)

So would I put them inside the already built model-line or outside of the model?

2 Likes

First, where did you get this? That would probably help some of us here
Second, maybe add some pictures to help better visualize what you’re trying to do