Hey guys, how are you doing? I hope you all do well. Being direct I’m trying to make an environment music to sound after a Gui goes down, but when I test that on the game it just plays the sound but not at the same time for every person on the server so you hear it as a disaster.
I don’t really know what to do in this case, there is no " for i, v in pairs() ", I actually think it’s the problem of the “wait(7.6)” but I don’t know how to fix it or what to do with it.
I do this on a LocalScript, and I have tried doing it with a ServerEvent (RemoteEvent) but the sounds don’t work in normal scripts.
When I do the server script part it doesn’t sound for any reason.
I know that here there is a lot of good people, and I’ll be very very grateful to you if you can give me a hand with this, even if It’s a little one. have a nice day!
Here’s the script:
- LocalScript
while wait(1) do
if game.ReplicatedStorage:WaitForChild('GivingTweens').Value == true then
break
end
end
if game.ReplicatedStorage:WaitForChild('GivingTweens').Value == true then
local Frame = script.Parent.Frame
script.Parent.Frame.Visible = true
Frame:TweenPosition(UDim2.new(0,0,0,0),"Out","Bounce",8)
wait(7.6)
game.ReplicatedStorage:WaitForChild('RemoteEvents').PutTensionMomentMusic:FireServer()
local UserInputService = game:GetService('UserInputService')
UserInputService.MouseIconEnabled = false
if game.ReplicatedStorage:WaitForChild('ChosenRoles').MonsterAlreadyChosen.Value == true then
for i, v in pairs(game.Players:GetPlayers()) do
local Character = v.Character
Character:FindFirstChild('IsAMonster')
if Character.IsAMonster.Value == true then
print("You did great! You're awesome!")
wait(3)
script.Parent.Parent.TweeningMonster.Frame.Visible = true
script.Parent.Frame.Visible = false
for i = 1, 100, 1 do
wait(0.04)
script.Parent.Parent.TweeningMonster.Frame.ImageLabel.ImageTransparency = script.Parent.Parent.TweeningMonster.Frame.ImageLabel.ImageTransparency - 0.01
script.Parent.Parent.TweeningMonster.Frame.Title.TextTransparency = script.Parent.Parent.TweeningMonster.Frame.Title.TextTransparency - 0.01
script.Parent.Parent.TweeningMonster.Frame.Description.TextTransparency = script.Parent.Parent.TweeningMonster.Frame.Description.TextTransparency - 0.01
end
wait(10)
for i = 1, 100, 1 do
wait(0.04)
script.Parent.Parent.TweeningMonster.Frame.ImageLabel.ImageTransparency = script.Parent.Parent.TweeningMonster.Frame.ImageLabel.ImageTransparency + 0.01
script.Parent.Parent.TweeningMonster.Frame.Title.TextTransparency = script.Parent.Parent.TweeningMonster.Frame.Title.TextTransparency + 0.01
script.Parent.Parent.TweeningMonster.Frame.Description.TextTransparency = script.Parent.Parent.TweeningMonster.Frame.Description.TextTransparency + 0.01
end
print('Wait 3')
wait(3)
print('Firing...')
game.ReplicatedStorage:WaitForChild('RemoteEvents').GoingUp:FireServer()
else
wait()
end
end
end
end
- ServerScript
game.ReplicatedStorage:WaitForChild('RemoteEvents').PutTensionMomentMusic.OnServerEvent:Connect(function()
game.SoundService.EnvironmentMusic.TensionMoment:Play()
game.SoundService.EnvironmentMusic.TensionMoment.Volume = 0.5
end)