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

Add 0.1 to pitch?

Asked by
NotSoNorm 777 Moderation Voter
10 years ago

Im having trouble making it so when you click on the button it adds 0.1 to the pitch

function Clicked()
    script.Parent.Parent.Parent.ScrollingFrame.Sound.Pitch +0.1
    script.Parent.Text = script.Parent.Parent.Parent.ScrollingFrame.Sound.Pitch
    wait(1)
    script.Parent.Text = "Change pitch"
end
script.Parent.MouseButton1Down:connect(Clicked)

2 answers

Log in to vote
0
Answered by 10 years ago

This might fix it:

function Clicked()
    script.Parent.Parent.Parent.ScrollingFrame.Sound.Pitch = script.Parent.Parent.Parent.ScrollingFrame.Sound.Pitch + 0.1
    script.Parent.Text = script.Parent.Parent.Parent.ScrollingFrame.Sound.Pitch
    wait(1)
    script.Parent.Text = "Change pitch"
end
script.Parent.MouseButton1Down:connect(Clicked)

I did not test it though...

Ad
Log in to vote
0
Answered by 10 years ago

Let's make it shorter

PitchChange = 0.1 --Good thing is, this can always be changed :D
Pitch = script.Parent.Parent.Parent.ScrollingFrame.Sound.Pitch
script.Parent.MouseButton1Down:connect(function() Pitch = Pitch+PitchChange 
wait(1)
script.Parent.Text = "Change Pitch"
end) --6 Lines used :D

Answer this question