Hey there. As a relatively inexperienced and new scripter, I am still trying to get my way around Lua.
Anywho, the main objective of what I am trying to do is to get a sound instance from ReplicatedStorage to some parts in a folder, then for all of them to play at the same time. What I mean by the same time is that they all start at the same time, not having a few ms delay between them.
I have already solved the replication part, its just the playing bit I’m having trouble with.
See, I want to primarily use a ServerEvent for this, though once I have finished writing this and some people comment, you can disagree with that.
I want to know what the best way to do this is, because I have looked all over youtube and the dev forum and no one has really asked this question.
Thanks!
If you want to see the code I used, it is here.
EventReciever
Event = game.ReplicatedStorage.SoundEvent
Event.OnServerEvent(function()
script.Parent.Sound:Play()
end
SoundReplicator
Sound = game.ReplicatedStorage.Sound
File = game.Workspace.TestFolder:GetChildren()
Event = game.ReplicatedStorage.SoundEvent
local function AddMusic()
for Number, Part in pairs(File) do
local ReplicatedItem = Sound:Clone()
ReplicatedItem.Parent = Part
end
end
wait(2)
print(“Got here”)
AddMusic()
Event:FireServer()
Also if any of my scripting is broken, which it is as the event fire doesn’t work, please help me.
Any help you could give would be awesome. Thank you.