Script not running/tweening

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.

Alright. Ill try that right now… :slight_smile:

Can I put it in Replicated Storage?

Yes, you can. Try it and see :slight_smile:

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

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

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