Well done, you just copied and pasted their script. You’re becoming a real programmer now.
Basically, the sound is the same properties as normal.
Then try to preload sound use script like this:
local playing = false
print("Script ready")
local WorkspaceService = game:GetService("Workspace")
local Sound = WorkspaceService.Folder.Sounds.BaseSound
local Sounds = {
Sound
}
repeat wait() until Sound.IsLoaded == true
local ContextProvider = game:GetService("ContentProvider")
ContextProvider:PreloadAsync(Sounds)
workspace.Folder.Obby.Start:WaitForChild("BaseStart").Touched:Connect(function(hit)
print("Part touched!")
if hit.Parent:FindFirstChild("Humanoid") and not playing then
print("Playing sound")
workspace.Folder.Sounds:WaitForChild("BaseSound"):Play()
playing = true
workspace.Folder.Sounds:WaitForChild("BaseSound").Ended:Wait()
playing = false
end
end)
This is far too complicated for what we’re doing here. I don’t think a delay because the sound is loading matters.
Also, why would you need the “WorkspaceService”?
It is not working. I do not understand why.
it is like this:
like this? local playing = false
print("Script ready")
workspace.Folder.Start:WaitForChild("BaseStart").Touched:Connect(function(hit)
print("Part touched!")
if hit.Parent:FindFirstChild("Humanoid") and (not playing) then
print("Playing sound")
workspace.Folder.Sounds:WaitForChild("BaseSound"):Play()
playing = true
workspace.Folder.Sounds:WaitForChild("BaseSound").Ended:Wait()
playing = false
end
end)
Idk but i always get any Service with GetService() method and call it (ServiceName)Service. It is just habit.
Change the workspace.Folder.Start
to workspace.Folder.Obby
Does that mean it works, or that it failed?
That is the problem. You shouldn’t use code that you don’t understand, simply because it is harder to modify if it breaks or you wish to change it. That is why we’re staying simple, and not using more complex code like RunService or Modules.
I see it now.
Instead, put workspace.Folder.Obby.Start.BaseStart
At this point I think it would be easier if you just went into Team Create with someone else, we’re cluttering the front page lol
I suggest you use snipping tool (Win + Shift + S) to take your screenshots, so that we can avoid all the other clutter on your screen. Also, use Alt + Tab to switch between windows quickly.
lol, bro it is not working. Idk why. the script shopws no error.`local playing = false
print(“Script ready”)
workspace.Folder.Obby.Start.BaseStart:WaitForChild(“BaseStart”).Touched:Connect(function(hit)
print(“Part touched!”)
if hit.Parent:FindFirstChild(“Humanoid”) and (not playing) then
print(“Playing sound”)
workspace.Folder.Sounds:WaitForChild(“BaseSound”):Play()
playing = true
workspace.Folder.Sounds:WaitForChild(“BaseSound”).Ended:Wait()
playing = false
end
end)`
this error: 374 Infinite yield possible on ‘Workspace.Folder.Obby.Start.BaseStart:WaitForChild(“BaseStart”)’ -
i edited the script so amyn times and this error is not disapearing. i even stoll it form people. (we are #1 on the leaderboard lol)
Again, try making the instances their own variables. Just copy and paste this code:
local baseStart = workspace.Folder.Obby.Start:WaitForChild(“BaseStart”)
local baseSound = workspace.Folder.Sounds:WaitForChild(“BaseSound”)
local playing = false
baseStart.Touched:Connect(function(hit)
print(“Part touched!”)
if hit.Parent:FindFirstChild(“Humanoid”) and (not playing) then
print(“Playing sound”)
baseSound:Play()
playing = true
baseSound.Ended:Wait()
playing = false
end
end)