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!
I want to know if there’s a way to get the specific part of multiple models
What is the issue? Include screenshots / videos if possible!
I am having trouble with the round system. I have three different maps and I am trying to check if player have touched end part in the map(My english broken so it might be hard to understand what i mean)
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried to put the end part in Workspace but the obby map seems to be different. I have looked for solutions on devforum but I couldn’t find any.
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!
if game.Workspace.EndPart.Touched:Wait() then
staus.Value = "Player has won the round"
wait(3)
break
end
Haven’t seen the rest of your code but you should probably use BasePart.Touched:Connect rather than an if statement
workspace.EndPart.Touched:Connect(function(touched)
local winner = game.Players:GetPlayerFromCharacter(touched.Parent)
if winner ~= nil then
-- do winner stuff here
end
end)
You can repeat the code above for the different EndParts of your maps - i.e. workspace.Maps.Obby1.EndPart, workspace.Maps.Obby2.EndPart etc etc
Thank you for the help. I want to ask if I have too much map and I dont want to repeat those like
workspace.Maps.Obby1.EndPart
workspace.Maps.Obby2.EndPart
what should I do?
Assuming you have no other parts named “EndPart”, other than the ones you want to use to declare winners, you could do a for loop to find multiple EndParts and then connect their .Touched events to the end function
local onTouched = function(touched)
local winner = game.Players:GetPlayerFromCharacter(touched.Parent)
if winner ~= nil then
-- do winner stuff here
end
end
for _,inst in ipairs(workspace.Maps:GetDescendants()) do
if inst.Name == "EndPart" and inst:IsA("BasePart") then
inst.Touched:Connect(onTouched)
end
end
The for loop will go through all the parts in the maps and check if it’s called EndPart and is a BasePart, and then connect the .Touched event to it