How to Local = (three parts/model) * one local
Hey, could you provide a little bit more info as in what it is you are looking for? Personally I’m not sure what your question is.
Like a normal script example with part.touch
so you need to do Local part = workspace.part
but I need to do Local part = worspace.multiplayer parts/model
You could keep all the parts/models in a folder in workspace, and then loop through that folder and connect the event to it.
for _, v in pairs(workspace.FolderName:GetChildren()) do
if v:IsA("BasePart") then
v.Touched:Connect(function(hit)
-- code here
end)
elseif v:IsA("Model") then
v:FindFirstChildWhichIsA("BasePart").Touched:Connect(function(hit)
-- code here
end)
end
end
there is no more simple Local = model, like just local = mode?
A variable is really intended to store one “object”, pretty much. Alternatively, you could also store them in a table, however this is basically what :GetChildren() does anyways. You’ll still have to use the looping method for it to effect all parts, however.
local ExampleTable = {workspace.Part1, workspace.Part2}
for _, v in pairs(ExampleTable) do
v.Transparency = 1
end
fair enough but…
local Hi,I,Do,Work,Aswell = "Hi","I","Do","Work","Aswell"
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.