TimePosition of audio not resetting

I have a GUI in StarterGui that has a sound. When you touch a certain block, a script in that block sets the SoundId and resets the TimePosition to 0.

The problem is that the TimePosition is not being set.

The script is a normal script.

Part = script.Parent
function onTouch(hit)
	if hit.Parent == nil then return end
	local h = hit.Parent:FindFirstChild("Humanoid")
	if h ~= nil then
		local player = game.Players[hit.Parent.Name]	
		local gui = player.PlayerGui.Music
		gui.Sound:Stop()
		gui.Sound.SoundId = "rbxassetid://idgoeshere"
		gui.Sound:Play()
		gui.Sound.TimePosition = 0
		
	end
end
door.Touched:connect(onTouch)

How should I go about fixing this?

Just dont set the TimePosition. It is one, a read-only property, and two, :Stop() already resets the time.

1 Like

I removed the Sound.TimePosition but the issue is still occuring.

your doing sound.timeposition after the sound starts playing

Try putting it in a local script because according to this:

https://developer.roblox.com/en-us/api-reference/property/Sound/TimePosition

the time position property will not replicate from server to client or vice versa.