Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

TimePosition error, How do I fix this?

Asked by
Nidoxs 190
9 years ago

I am using time position to loop a sound. But when I use TimePosition it ignores the command and just plays the sound for the start. Here is my out put :

Output : Sound.TimePosition was set from local script while either in Workspace or SoundService. Only use a server script to set TimePosition when a sound is in these locations.

The LOCAL SCRIPT is in a tool. And is in ServerStorage to begin with until I touch a brick which clones it from ServerStorage to my backpack. Please explain what the output means! :(

2 answers

Log in to vote
6
Answered by 9 years ago

Please make sure to include your code in your question next time. Thanks for giving the code to me so that I could fix this.

The solution that I came up with for this situation is a bit unethical, but it works. When you clone the sound to the player's torso, also clone a server script (the object called "Script" in studio) into the torso. Make sure that this is in the script that you will be copying.

sound = script.Parent.Noise

sound.Changed:connect(function()
    if sound.TimePosition < 2 and sound.IsPlaying == true then
        sound.TimePosition = 2
        wait(4.5)
        sound:Play()
        sound.TimePosition = 2
        wait(4.5)
        sound.Pitch = 1.3
        sound.TimePosition = 4.6
    end
end)

You would still keep the original wait(6.5) in the LocalScript so that the sound stalls in playing. This should work. If you run into any problems, please let me know and I can fix them for you.

Ad
Log in to vote
0
Answered by 9 years ago

The output basically is trying to tell you that you should use a normal script instead of a local script for your tool (assuming your tool is trying to change the TimePosition property.)

This is because you're trying to make changes to the sound which is replicated to the server (as the sound is in the workspace) with a local script, which does not work.

Answer this question