Badged1
(Badged)
#1
Hello, I’m trying to make it so that the pitch of the sound changes randomly each time you click the tool. This is what I have so far.
local sound = script.Parent.Handle.Fire
script.Parent.Activated:Connect(function()
sound.Pitch = math.random(1, 6)
end)
I would’ve thought it would work but I guess not. If anyone knows how to fix it please let me know.
1 Like
Downrest
(Down)
#2
I’m pretty sure ‘Pitch’ is deprecated, use PitchShiftSoundEffect instead.
Badged1
(Badged)
#3
Hi, the pitch changes but, it only changes once. It doesnt change with each click like I thought I put into the script.
1 Like
Downrest
(Down)
#4
Try this instead:
local sound = script.Parent.Handle.Fire
local rand = Random.new()
script.Parent.Activated:Connect(function()
sound.Pitch = rand:NextInteger(1, 6)
warn(sound.Pitch)
end)