The issue is, is that, when I try to click the "Play Sound" button, (even on like... 1 hour long sounds) it just immediately changes the text to "Stop Sound" and another microsecond later it changes to "Play Sound" without playing the audio. The things I tried is inside the code block below.
local Module = require(game.StarterGui.eText)
local btn = script.Parent.Parent.BtnPlay
local input = script.Parent.Parent.Input
local sound = workspace.Sound
local playing = false
btn.MouseButton1Click:Connect(function()
if playing == false then -- (<-- Which is this one) I tried to make it easier for the script to understand but didn't work, the previous one was
-- "if not playing then"
sound.SoundId = "rbxassetid://" .. input.Text
sound:Play()
Module.ApplyText(btn, "Stop Sound")
playing = true
wait(sound.TimeLength) -- If I put it to 8 seconds, the sound will play for 8 seconds but
-- I want it to wait for the sounds length but doesn't work
sound:Stop()
sound.SoundId = ""
Module.ApplyText(btn, "Play Sound")
Module.ClearText(input)
playing = false
elseif playing == true then
sound:Stop()
sound.SoundId = ""
Module.ApplyText(btn, "Play Sound")
Module.ClearText(input)
playing = false
end
end)

4 comments
ok so... in local sound do local sound = game.Workspace.Sound
not sure what the point of sound.SoundId = "" is because when you stop the sound it wont play and when you enter a new one it will automatically clear it
"workspace" is the same as "game.Workspace" but shorter
Just replying to your "not sure what the point of sound.SoundId = "" is ... ": Ohhh ok!