So, i try to make a command for set the pitch of a SoundEffect but i have this error and i don’t know why
The code
commands.pitch = function(sender, arguments)
if isAdmin(sender) then
local pitch = arguments[1]
if pitch then
if tonumber(pitch) > 2 then
SendClientNotification:FireClient(sender, "Pitch", "Max pitch is 2")
else
local MusicPlayerPitch = game.Workspace:WaitForChild("MedStudioMusicPlayer").Pitch
MusicPlayerPitch.Octave = tonumber(pitch)
SendClientNotification:FireClient(sender, "Pitch", "Pitch set to"..pitch)
end
end
end
end
I have the impression that it does not detect pitch but yet it is the good parent
What value (or at least the data type) did you except for MusicPlayerPitch? It looks like the value for MusicPlayerPitch is a double (number) reading the error message.
No what’s the value of the MusicPlayerPitch, not the value of a pitch?
You’re indexing a double (number) with Ocatve.
Try printing to see what value is it
print(MusicPlayerPitch);
Does it print out a double (number) value? If it does then that’s the problem.
Yes, is here it should work because me too it is there and it is not a problem of the studio because that does not work on roblox either, I can see your script has you and how to aver you to place all?
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
local number = tonumber(msg)
if number then
print(type(number)) -- prints out number
path_to_pitchshift.Octave = number
end
end)
end)
script.MedStudioMusicPlayer.Parent = game.Workspace -- Music System
local MedStudioMusicPlayer = game.Workspace:WaitForChild("MedStudioMusicPlayer")
MedStudioMusicPlayer.Pitch.Octave = 2
Change local MusicPlayerPitch = game.Workspace:WaitForChild("MedStudioMusicPlayer").Pitch to local MusicPlayerPitch = game.Workspace:WaitForChild("MedStudioMusicPlayer"):WaitForChild("Pitch")