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

Add 0.1 to pitch?

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

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...

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

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