Ok, so a friend helped me out to get it functioning properly, the only issue I had is that I had to get the “Complete” parts outside of the levels and now it won’t say what level they just completed. Is there a way to make a StringValue to make it say which area (Level) they’re currently in?
I have soundRegion parts where it plays if ur inside the specific part, I was wondering if I could make it if they are touching that part, the StringValue gets updated to the LevelName.
Here’s the current code I have right now:
wait(1)
local levels = workspace:WaitForChild("Levels"):GetChildren()
local repStorage = game:GetService("ReplicatedStorage")
local remotes = repStorage:WaitForChild("Remotes")
local reset = remotes:WaitForChild("Reset")
local Transition = require( repStorage:WaitForChild("Client").Transition )
local debounce = false
local touchPart = script.Parent
local plr = game:GetService("Players")
for _, level in levels do
if level:IsA("Folder") then print(level) continue end
level.Complete.Touched:Connect(function(hit)
if debounce == false then
print("CompleteFunction Started")
local player = plr:GetPlayerFromCharacter( hit.Parent )
local name = hit.Parent.Name
if ( not player ) then return end
debounce = true
-- do other stuff
game:GetService("TextChatService").TextChannels.RBXSystem:DisplaySystemMessage(
"<font color=\"rgb(137, 255, 129)\">[System]: "..name.." has completed "..touchPart.Parent.Name.."!</font> "
)
task.wait(2)
Transition.Start()
hit.Parent:FindFirstChild("Humanoid").Parent:MoveTo(Vector3.new(-76, 4.35, -14))
task.wait(0.1)
Transition.Out()
task.wait(3)
debounce = false
end
end)
end
I would love to really solve the issue of it just printing the Levels folder and actually print what level they in. Any info for that would be a great help.
Here is an image providing CompletePart locations, and the SoundRegion parts: