You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
Title.
What is the issue? Include screenshots / videos if possible!
It fails, just saying me these two things in the output:
The weird thing, I do have a model called “The Maze (Easy)”. It spawns just when the script is activated. When I don’t use the WaitForChild function, it just says it doesn’t exist.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Here’s the script for the connections (for the music changing script):
Im on mobile so expect some bugs. Also im NOT 100% sure.
local touchpartsmodel = --group every part you want to use in 1 function
for i,v in pairs(touchpartsmodel:GetChildren()) do
if v:isA("BasePart") then
v.Touched:connect(functon(hit)
--code here
end)
end
end
why does my code look like that lol oh nvm i fixed it
Umm, I think I used this same method in an earlier version of my script:
local children = script.Parent.Parent:WaitForChild("The Maze (Easy)").Spawns:GetChildren()
for i, v in pairs(children) do
--since everything in that directory is a part, I don't need to specify whether if it's a basepart...
v.Touched:Connect(ChangeMusic)
end