Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Script that picks a random sound from a folder and plays it, not working?

I do not what to do in this situation, help would be great..

`local random = game.Workspace.WinSounds
local selectrandom = math.random(1,3)
script.Parent.Touched:Connect(function(hit)
	local h = hit.Parent:FindFirstChild("Humanoid")
	if (h~=nil) then
		local selected = random:GetChildren()
		local final = selected(selectrandom)
		final:Play()
		game.ReplicatedStorage.vals.Winner.Value = hit.Parent.Name
		script.Parent:Destroy()
	end
end)`

1 answer

✓ Accepted answer

Try doing selected[selectrandom] with square brackets.

1 comment

0

Thx!

This discussion is preserved as it was. New answers, comments, and votes are closed.