Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Hello people of scriptinghelpers! I need some help with my talking script?

Fixed! Thank you youtube master wow, I had to put a modification at the end to make it not glitch out and be weird, thank you!

while true do
    wait()
    if game.Workspace.NPC.Head.speach.PlaybackLoudness <= 65 then
        game.Workspace.NPC.Head.Mouth.Texture = "rbxassetid://2801767831"
    elseif game.Workspace.NPC.Head.speach.PlaybackLoudness <= 75 and game.Workspace.NPC.Head.speach.PlaybackLoudness > 65 then
        game.Workspace.NPC.Head.Mouth.Texture = "rbxassetid://2801751501"
    elseif game.Workspace.NPC.Head.speach.PlaybackLoudness <= 85 and game.Workspace.NPC.Head.speach.PlaybackLoudness > 75 then
        game.Workspace.NPC.Head.Mouth.Texture = "rbxassetid://845217767"
    elseif game.Workspace.NPC.Head.speach.PlaybackLoudness <= 95 and game.Workspace.NPC.Head.speach.PlaybackLoudness > 85 or game.Workspace.NPC.Head.speach.PlaybackLoudness > 75 then
        game.Workspace.NPC.Head.Mouth.Texture = "rbxassetid://907601394"
    end
end

1 comment

0

If this is a Server Script, then PlaybackLoudness will always be 0 since there is no audio output on the Server, this needs to be run from the Client, use a LocalScript

1 answer

✓ Accepted answer

Hello. The problem is that you wrote <= which means less than or equal to. This would not work as 75, 85, and 95 are greater than 65. Try adding a simple and statement that checks if it's louder than the other if statements.

while true do
    wait()
    if script.Parent.speach.PlaybackLoudness <= 65 then
        script.Parent.Mouth.Texture = "rbxassetid://2801767831"
    elseif script.Parent.speach.PlaybackLoudness <= 75 and  script.Parent.speach.PlaybackLoudness > 65 then
        script.Parent.Mouth.Texture = "rbxassetid://2801751501"
    elseif script.Parent.speach.PlaybackLoudness <= 85 and  script.Parent.speach.PlaybackLoudness > 75 then
        script.Parent.Mouth.Texture = "rbxassetid://845217767"
    elseif script.Parent.speach.PlaybackLoudness <= 95 and  script.Parent.speach.PlaybackLoudness > 85 then
        script.Parent.Mouth.Texture = "rbxassetid://907601394"
    end
end

Please accept and upvote this answer if it helped.

1 comment

0

Your edit is unnecessary, say for example PlaybackLoudness is 80, on the first condition, 80 > 65, the statement returns false, on the second condition 80 > 75, again returning false, the next condition, 80 < 85 so it returns true and updates the texture

This discussion is preserved as it was. New answers, comments, and votes are closed.