Ok so idk, this is a local script, and I'm tryign to make it work with filtering enabled, but it doesn't work with it on or without it on what am I doing wrong?
local Audio = script.Parent.Parent.Sound local playerpath = game.Players.LocalPlayer.PlayerGui:WaitForChild("Timer") or game.Players.LocalPlayer.PlayerGui:FindFirstChild("Timer") Audio.Changed:connect(function() local Length = Audio.TimeLength repeat wait() until Length ~= 0 for i = 0, math.ceil(Length), 1 do local PitchLevel = Audio.Pitch local Difference = PitchLevel - 1 wait(1 - Difference) if Audio.IsPlaying then local TimePos = math.ceil(Audio.TimePosition) --script.Parent.Parent.TextBar.Text = TimePos playerpath.MainTiming.Empty.Filler:TweenSize(UDim2.new(0, TimePos, 1, 0), "Out", "Bounce", 1, true) else if not Audio.IsPlaying then wait(1) --script.Parent.Parent.TextBar.Text = "0" wait(.2) playerpath.MainTiming.Empty.Filler:TweenSize(UDim2.new(0, 0, 1, 0), "Out", "Bounce", 1, true) break end end end end)
LocalPlayer
, you're calling it before it exists...
...That's all, really. All you need is
repeat wait() until game.Players.LocalPlayer
on the top or any other line that would wait for LocalPlayer to appear.
As for the script in general, of course it works in FilteringEnabled as the script only refers to the Player
as an instance and it's children ever (Along with Audio which i suppose is in an allowed position too). You were too concentrated to that though so you thought it had more restrictions than it had.
Or you didn't know that scripts execute when possible, which is usually a bit before the first Player
instance gets created. So you must wait for said Player
instance to exist before working with it.
repeat wait() until game.Players.LocalPlayer local Audio = script.Parent.Parent.Sound local playerpath = game.Players.LocalPlayer.PlayerGui:WaitForChild("Timer") or game.Players.LocalPlayer.PlayerGui:FindFirstChild("Timer") Audio.Changed:connect(function() local Length = Audio.TimeLength repeat wait() until Length ~= 0 for i = 0, math.ceil(Length), 1 do local PitchLevel = Audio.Pitch local Difference = PitchLevel - 1 wait(1 - Difference) if Audio.IsPlaying then local TimePos = math.ceil(Audio.TimePosition) --script.Parent.Parent.TextBar.Text = TimePos playerpath.MainTiming.Empty.Filler:TweenSize(UDim2.new(0, TimePos, 1, 0), "Out", "Bounce", 1, true) else if not Audio.IsPlaying then wait(1) --script.Parent.Parent.TextBar.Text = "0" wait(.2) playerpath.MainTiming.Empty.Filler:TweenSize(UDim2.new(0, 0, 1, 0), "Out", "Bounce", 1, true) break end end end end)
Hope i helped!