I am trying to track down (and it has been 2 years so learning all of this again) what I need to do to fix this script (I bet more are like this one).
local wspace = game.Workspace
local rumble = wspace.RumbleSoundPart
local magnitude = 0
local temp = 0
local temp2 = 0
local maxdistance = 18
while true do
wait(0.5)
for i,v in pairs(game.Players:GetChildren()) do
magnitude = ((v.Character.Head.Position - wspace.RumbleSoundPart.Position).magnitude) - 4
if magnitude < 1 then magnitude = 1 end
temp = (magnitude/maxdistance)
if temp > 0.4 then temp = 0.4 end
temp2 = 1 - temp
if temp2 > 0.4 then temp2 = 0.4 end
if temp2 < 0 then temp2 = 0 end
wspace.MusicScript.Sound.Volume = temp
wspace.MusicScript.Sound1.Volume = temp
wspace.MusicScript.Sound2.Volume = temp
wspace.RumbleSoundPart.Sound.Volume = temp2
end
end
Error is Attempt to index field 'Character' (a nil value). What should I add to make sure the character is in the game before this gets called? I tried a few things but nothing seemed to work.

1 comment
;c