AFK Grinder Gem shop upgrader

Hello!

I am encountering a problem where I have made an AFK Grinder and a Gem shop upgrade. But when I spend my gems on that upgrade the AFK Grinder multiplier dosen’t increase from 1x to 1.5x. I am using simulator generator by LucaDaBoy.

AFK Grinder script: and Gem Shop script:

local part = script.Parent
local RS = game:GetService("ReplicatedStorage")

local baseAddedClicks = 100
local upgradeMultiplier = 1.5

local connections = {}
local lastClickTime = {}

local function GetUpgradedClicks(player)
	local upgradeLevel = player.Data.PlayerData.GemUpgrade1.Value
	return math.floor(baseAddedClicks * (upgradeMultiplier ^ upgradeLevel))
end

local function CanAddClicks(player)
	local currentTime = tick()
	if not lastClickTime[player] or (currentTime - lastClickTime[player]) >= 1 then
		lastClickTime[player] = currentTime
		return true
	end
	return false
end

local function CreateTimer(player)
	local timer = Instance.new("BoolValue")
	timer.Name = "ClicksTimer"
	timer.Parent = player
	return timer
end

local function OnTouched(otherPart)
	local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)

	if player then
		local Clicks = player.Data.PlayerData.Currency
		local ClicksTimer = player:FindFirstChild("ClicksTimer")

		if not ClicksTimer then
			local timer = CreateTimer(player)
			local addedClicks = GetUpgradedClicks(player)
			Clicks.Value += addedClicks

			connections[player] = task.spawn(function()
				while timer and timer.Parent do
					task.wait(1)
					addedClicks = GetUpgradedClicks(player)
					Clicks.Value += addedClicks
				end
			end)
		end
	end
end

local function OnTouchEnded(otherPart)
	local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)

	if player and connections[player] then
		task.cancel(connections[player])
		connections[player] = nil

		local timer = player:FindFirstChild("ClicksTimer")
		if timer then
			timer:Destroy()
		end
	end
end```

GEM SHOP SCRIPT:
local Gemshop = ReplicatedStorage.GemShop
local Defaultwalkspeed = Player.Character.Humanoid.WalkSpeed

local function GemRing()
	while task.wait(0.1) do
		if (Player.Character.HumanoidRootPart.Position - workspace.Map.Rings.GemShop.MainPart.Position).Magnitude < 10 then
			if not Frames.GemShop.Visible then
				Utilities.ButtonHandler.OnClick(Frames.GemShop, UDim2.new(0.359,0,0.414,0))
			end
		end

		if Player.Character then
			local Walkspeed = Defaultwalkspeed + Gemshop["1"].Reward.DefaultReward.Value + Gemshop["1"].Reward.IncreasePer.Value * (PlayerData.GemUpgrade1.Value+1)
			Player.Character.Humanoid.WalkSpeed = Walkspeed
		end
	end
end

coroutine.wrap(GemRing)()

local GemUpgradeTemplate = Frames.GemShop.Upgrades.Template
GemUpgradeTemplate.Parent = script
GemUpgradeTemplate.Name = "GemUpgradeTemplate" -- this moves the template from the ui to the script (easier for people to edit :) 

for _,v in Gemshop:GetChildren() do
	local i = v.Name
	local NewUpgrade = GemUpgradeTemplate:Clone()
	NewUpgrade.LayoutOrder = tonumber(i)
	NewUpgrade.Name = i
	NewUpgrade.Title.Text = v.UpgradeName.Value

	local function CalcReward(Reward)
		local R = v.Reward

		if R.Exponential.Value then
			return R.DefaultReward.Value + R.IncreasePer.Value ^ Reward
		else
			return R.DefaultReward.Value + R.IncreasePer.Value * Reward
		end
	end

	local function CalcCost()
		local C = v.Price

		if C.Exponential.Value then
			return C.DefaultPrice.Value * C.IncreasePer.Value ^ PlayerData["GemUpgrade"..i].Value
		else
			return C.DefaultPrice.Value + C.IncreasePer.Value * (PlayerData["GemUpgrade"..i].Value+1)
		end
	end

	local function Update()
		local O = v.Operator.Value
		local CurrentLevel = PlayerData["GemUpgrade"..i].Value

		if CurrentLevel < v.Max.Value then
			NewUpgrade.Description.Text = O..Utilities.Short.en(CalcReward(CurrentLevel)).." > "..O..Utilities.Short.en(CalcReward(CurrentLevel+1))
			NewUpgrade.Buy.Amount.Text = Utilities.Short.en(CalcCost())
		else
			NewUpgrade.Description.Text = O..Utilities.Short.en(CalcReward(CurrentLevel)).." > Max"
			NewUpgrade.Buy.Amount.Text = "Max"
		end
	end

	Update()
	PlayerData["GemUpgrade"..i].Changed:Connect(Update)

	NewUpgrade.Parent = Frames.GemShop.Upgrades

	NewUpgrade.Buy.Click.MouseButton1Click:Connect(function()
		Remotes.GemUpgrade:FireServer(i)
	end)
end

Anyone know how to separate both scripts?

Any solutions to this problem this is very URGENT! Also if you need to come into my game to fix the problem the you can!