I honestly feel bad already by uploading this to the site as I'm using it for a scripting application (as he didn't want my Courthouse tech for some reason). I don't know if I'll delete it after or not.
I guess I can't use these values because they're in a different function. I've commented on each line so you understand.
Error:
Players.Player.PlayerGui.MoneyScript:34: attempt to index global '(one of the variables that are there, sometimes random, sometimes not based on what is there and not)' (a nil value)
IGNORE there's missing lines at the top. There's a comment I didn't include.
Code:
-- Variables
game.Players.PlayerAdded:connect(function(plr)
MPM = Instance.new("NumberValue", game.ReplicatedStorage) -- Money Per Minute (not to be edited)
MPM.Name = plr.Name.."_MPM"
MPM.Value = 100
CM = Instance.new("NumberValue", game.ReplicatedStorage) -- Current Money (could be edited, for starting money.)
CM.Name = plr.Name.."_CM"
CM.Value = 0
MPMMultiplier = Instance.new("NumberValue", game.ReplicatedStorage) -- Money Per Minute Multipler (should be edited, also edited by the buy button)
MPMMultiplier.Name = plr.Name.."_MPMMultiplier"
MPMMultiplier.Value = 1
FMPM = Instance.new("NumberValue", game.ReplicatedStorage) -- Multipled MPM and MPMMultipler. No need to touch this at all.
FMPM.Name = plr.Name.."_FMPM"
end)
CMText = script:WaitForChild("MoneyGui").Frame.CurrentMoney
while wait(1) do -- usually 60, but for testing purposes is 1
FMPM.Value = (MPM.Value * MPMMultiplier.Value) -- Multiplies MPM (100) by the MPM Multiplier
CM.Value = (CM.Value + FMPM.Value) -- Adds the Money Per Minute to the Current Money
CMText.Text = CM.Value -- Quite simply changes the text that the user can see, their money, to the Value of CMValue
print("Money added")
end
I tried using ACTUAL value objects placed in there but it just wasn't working right and was annoying me a lot. So I switched to doing it in a script. I don't know how I'll do functions for adding to the value or anything so that it doesn't interfere :(
ANY SOLUTIONS to this situation and fixes to what I should do to this script? This has to be perfect, and I'm STUMPED.

2 comments
Could you make prints on every line to see where it stops?
Not the issue.