How do you communicate between scripts?

So I have 2 scripts, one is a local script inside of a frame in StarterGui, and one is a script in ServerScriptService.

Local Script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local addmoney = ReplicatedStorage:WaitForChild("AddMoney")
local player = game.Players.LocalPlayer
local sound = ReplicatedStorage.SoundStorage:WaitForChild("clicksound")

for i, v in pairs(script.Parent:GetChildren()) do
	if v:IsA("TextButton") then
		v.MouseButton1Click:Connect(function()
			if v ~= nil then
				if player ~= nil then
					addmoney:FireServer()
					sound:Play()
				end
			end
		end)
	end
end

Server Script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local addmoney = ReplicatedStorage:WaitForChild("AddMoney")
local sound = ReplicatedStorage.SoundStorage:WaitForChild("clicksound")

addmoney.OnServerEvent:Connect(function(player)
	if player ~= nil then
		local cash = game.ServerStorage:FindFirstChild(player)
		cash.Value += v.Name 
	end
end)

Currently, v is an “unknown global” and cannot be accessed by the server script. How would I make it so the local script tells the local script what v is?

You can send v.Name through the remote event as a parameter.

Local Script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local addmoney = ReplicatedStorage:WaitForChild("AddMoney")
local player = game.Players.LocalPlayer
local sound = ReplicatedStorage.SoundStorage:WaitForChild("clicksound")

for i, v in pairs(script.Parent:GetChildren()) do
	if v:IsA("TextButton") then
		v.MouseButton1Click:Connect(function()
			if v ~= nil then
				if player ~= nil then
					addmoney:FireServer(tonumber(v.Name))
					sound:Play()
				end
			end
		end)
	end
end

Server Script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local addmoney = ReplicatedStorage:WaitForChild("AddMoney")
local sound = ReplicatedStorage.SoundStorage:WaitForChild("clicksound")

addmoney.OnServerEvent:Connect(function(player, value)
	if player ~= nil and value ~= nil then
		local cash = game.ServerStorage:FindFirstChild(player)
		cash.Value += value
	end
end)

Bruh

addmoney:FireServer(v)

Plus a hacker can bypass this script LOL