Ulxqra
(Ulxqra)
December 1, 2020, 7:17am
1
Type: LocalScript
Issue: Not running, no errors in output.
What its supposed to do: Play sounds when something is tweened, It worked until I added so It played sounds.
Script:
local Object = script.Parent.Welcome
local Object2 = script.Parent.To
local Object3 = script.Parent.RobberyWorld
local Sounds = game.ServerStorage:WaitForChild("Sounds")
wait(0.1)
Object.Position = UDim2.new(0.5,0,-0.2,0)
Object2.Position = UDim2.new(0.5,0,-0.2,0)
Object3.Position = UDim2.new(0.5,0,-0.2,0)
wait(2)
Object:TweenPosition(UDim2.new(0.5,0,-0,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 0.5)
Sounds.Woosh:Play()
wait(0.7)
Object2:TweenPosition(UDim2.new(0.5,0, 0.192, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 0.5)
Sounds.WooshPitchDiff:Play()
wait(0.7)
Object3:TweenPosition(UDim2.new(0.5,0, 0.348, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 0.5)
Sounds.Ding:Play()
A localscript can’t access ServerStorage, only the server can. Try moving your sound folder to StarterGui and play it there.
Ulxqra
(Ulxqra)
December 1, 2020, 7:49am
3
Alright. Ill try that right now…
Ulxqra
(Ulxqra)
December 1, 2020, 7:51am
4
Can I put it in Replicated Storage?
Yes, you can. Try it and see
Ulxqra
(Ulxqra)
December 1, 2020, 7:57am
6
One last question, do I need the waitforchild? I added it bc before it said sounds does not exist, but now that its fine, do I need it?
I’m not entirely sure, though I believe contents of Replicated Storage are always replicated when the datamodel loads in. So I would say it’s not needed. Unless, you’re changing it via running time, I don’t believe you need to use WaitForChild().
1 Like
Jxs_Adi
(ChvaosX)
December 1, 2020, 8:27am
8
Unfortunately, you can not play sounds inside the folder with FindFirstChild, you have to specify the folder inside the script, then use Parent to choose the sound you want.
local Object = script.Parent.Welcome
local Object2 = script.Parent.To
local Object3 = script.Parent.RobberyWorld
local Sfx = game.ServerStorage.Sounds
wait(0.1)
Object.Position = UDim2.new(0.5,0,-0.2,0)
Object2.Position = UDim2.new(0.5,0,-0.2,0)
Object3.Position = UDim2.new(0.5,0,-0.2,0)
wait(2)
Object:TweenPosition(UDim2.new(0.5,0,-0,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 0.5)
Sfx.Woosh:Play()
wait(0.7)
Object2:TweenPosition(UDim2.new(0.5,0, 0.192, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 0.5)
Sfx.WooshPitchDiff:Play()
wait(0.7)
Object3:TweenPosition(UDim2.new(0.5,0, 0.348, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 0.5)
Sfx.Ding:Play()
1 Like
Ulxqra
(Ulxqra)
December 1, 2020, 8:29am
9
I dont think I used FindFirstChild. I am sure I used WaitForChild()
Try to use tween service and see if it works. Also different tweening enums might not work.
1 Like