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

How do i make a part move with Y Value on how loud the volume is?

Asked by 4 years ago

Code : while true do wait() local sound = script.Parent.Parent.Zombie script.Parent.Position = script.Parent.Position + 1+((sound.PlaybackLoudness/1000)*3.5) end

0
Put your code in a code block JesseSong 3916 — 4y
0
i dont know how to put it in code block im new to this website MadnessMyth 10 — 4y

2 answers

Log in to vote
1
Answered by
Leamir 3138 Moderation Voter Community Moderator
4 years ago

Hello, MadnessMyth!

while true do 
wait() 
local sound = script.Parent.Parent.Zombie 
script.Parent.Position = script.Parent.Position + Vector3.new(0, 1+((sound.PlaybackLoudness/1000)*3.5), 0) -- script.Parent.Position is a Vector3 value
end

If this code don't works, please post a comment to this answer that i'll try to fix it

0
it only goes up and not back down. MadnessMyth 10 — 4y
0
I kinda fixed it? i wanted it to be like half life 2 mouth movement talking MadnessMyth 10 — 4y
Ad
Log in to vote
0
Answered by
JesseSong 3916 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago
while true do 
    wait() 
    local debounce = true
local vecPoint = Vector3.new(0,0,0)
local closestPlayer, smallestMagnitude = nil,math.huge
if debounce then



for _, player in pairs(game.Players:GetPlayers()) do
     local distance = player:DistanceFromCharacter(vecPoint)
     if distance < smallestMagnitude then
    debounce = true
          smallestMagnitude = distance
          closestPlayer = player
wait(2.5)
print (distance)
debounce = false
     end
end
end
-- create a sound
local sound = Instance.new("Sound", game.Workspace)
sound.SoundId = "rbxassetid://4277136473" -- change this to your game id
sound.Looped = true -- do you want it looped if yes then leave it
sound.PlaybackSpeed = 1

-- make the sound loud
sound.Volume = 2-- the voloume 

-- play the sound
sound:Play()-- tells the script to play
 -- waits 7 seconds

-- make the sound quiet
sound.Volume = 0.3
end
0
its in studio No game. MadnessMyth 10 — 4y

Answer this question