local function i(i,M)local Y=i:WaitForChild("\115\116\097\116\115")local U=Y:WaitForChild(GameSettings.pointsName)local X=Y:WaitForChild("\084\111\116\097\108"..GameSettings.pointsName)U.Value=U.Value+M if M>0 then X.Value=X.Value+M end DataStore:IncrementPoints(i,M)end local function M(i)local M=i:WaitForChild("\115\116\097\116\115")local Y=M:WaitForChild(GameSettings.pointsName)local U=M:WaitForChild(GameSettings.upgradeName)UpgradeManager:BuyUpgrade(i)end local function Y(i)ParticleController.EmitCheckpointParticle(i)end local function U(i)UpgradeManager:AddUpgrade(i)end local function X(i,M)if M then i.DevComputerMovementMode=Enum.DevComputerMovementMode.UserChoice i.DevTouchMovementMode=Enum.DevTouchMovementMode.UserChoice else i.DevComputerMovementMode=Enum.DevComputerMovementMode.Scriptable i.DevTouchMovementMode=Enum.DevTouchMovementMode.Scriptable end end local function C(i)UpgradeManager:SetWalkspeedToCurrentUpgrade(i)end
-- Local Functions
-- Get their stats and update the value
local function updatePlayerPoints(player, valueToAdd)
	local stats = player:WaitForChild("stats")
	local points = stats:WaitForChild(GameSettings.pointsName)
	local totalPoints = stats:WaitForChild("Total" .. GameSettings.pointsName)

	points.Value = points.Value + valueToAdd
	if valueToAdd > 0 then
		totalPoints.Value = totalPoints.Value + valueToAdd
	end
	DataStore:IncrementPoints(player, valueToAdd)
end

local function makeUpgradePurchase(player)
	local stats = player:WaitForChild("stats")
	local points = stats:WaitForChild(GameSettings.pointsName)
	local upgrades = stats:WaitForChild(GameSettings.upgradeName)

	UpgradeManager:BuyUpgrade(player)
end

local function touchCheckpoint(player)
	ParticleController.EmitCheckpointParticle(player)
end

local function addPlayerUpgrade(player)
	UpgradeManager:AddUpgrade(player)
end

local function changeController(player, defaultController)
	if defaultController then
		player.DevComputerMovementMode = Enum.DevComputerMovementMode.UserChoice
		player.DevTouchMovementMode = Enum.DevTouchMovementMode.UserChoice
	else
		player.DevComputerMovementMode = Enum.DevComputerMovementMode.Scriptable
		player.DevTouchMovementMode = Enum.DevTouchMovementMode.Scriptable
	end
end

local function onPlayerEnteredGame(player)
	UpgradeManager:SetWalkspeedToCurrentUpgrade(player)
end
