How to fix SliderGui server-sided script

I have a script inside of a Gui, that creates a slider that changes the speed of a particle.
I also want to make it connect to the server, so others can see the change, yet I’m not able to get it to work.

-- -- UI-related
local slider : GuiObject = script.Parent.Bar
local knob : TextButton = slider:FindFirstChild("Knob") :: TextButton
local previousSliderValue = 0
local sliderValue = 0 -- A multiplier between 0 to 1.

-- -- Target-related
local fountains = {
workspace.RingBTMCenter.Fountain1.cannon.core.fountain,
workspace.RingBTMCenter.Fountain2.cannon.core.fountain,
workspace.RingBTMCenter.Fountain3.cannon.core.fountain,
workspace.RingBTMCenter.Fountain4.cannon.core.fountain,
workspace.RingBTMCenter.Fountain5.cannon.core.fountain,
workspace.RingBTMCenter.Fountain6.cannon.core.fountain,
workspace.RingBTMCenter.Fountain7.cannon.core.fountain,
workspace.RingBTMCenter.Fountain8.cannon.core.fountain
}
local speedRange = Vector2.new(0, 90) -- Set the minimum and maximum speed here. (MinimumValue, MaximumValue)

-- -- Services & Events
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ValueChanged = ReplicatedStorage:WaitForChild("ValueChanged")

-- -- Dynamic variables
local mousePositionOnClick = Vector2.zero -- Starting from the point where the mouse clicked.
local mousePositionOnMove = Vector2.zero -- Updates every mouse move.

local trackingConnection : RBXScriptConnection
local isTrackingMouse = false
local isMouseOverKnob = false

-- -- A linear interpolation (Lerp) function for speed.
local function GetNewSpeed(Value : number) : number
	return speedRange.X + (speedRange.Y - speedRange.X) * math.clamp(Value, 0, 1)
end

-- -- Slides with the mouse.
local function UpdateSlider(Value : number)
	knob.Position = UDim2.new( -- Retain most of its position minus X.Scale.
		UDim.new(Value, knob.Position.X.Offset),
		knob.Position.Y
	)
end

-- -- Get the "delta" between the initial position of click to the current mouse position.
local function GetDelta()
	return mousePositionOnMove - mousePositionOnClick
end

-- -- Start tracking the mouse upon pressing.
local function StartTrackingMouse()
	if isTrackingMouse then
		return
	end

	mousePositionOnClick = UserInputService:GetMouseLocation() -- Set initial mouse position.

	trackingConnection = UserInputService.InputChanged:Connect(function(Input)
		if Input.UserInputType == Enum.UserInputType.MouseMovement then
			local barCurrentSize = slider.AbsoluteSize.X
			mousePositionOnMove = UserInputService:GetMouseLocation()

			local delta = GetDelta()
			local scaleOffset = delta.X / barCurrentSize
			local newPosition = math.clamp(previousSliderValue + scaleOffset, 0, 1)

			sliderValue = newPosition
			
			for i, fountains in pairs(fountains) do
				ValueChanged:FireServer()
			end

			UpdateSlider(newPosition)
		end
	end)

	previousSliderValue = sliderValue
	isTrackingMouse = true
end

-- Stop tracking the mouse upon user releasing it.
local function StopTrackingMouse()
	if not isTrackingMouse then
		return
	end

	trackingConnection:Disconnect()
	isTrackingMouse = false
end

knob.MouseButton1Down:Connect(StartTrackingMouse)
UserInputService.InputEnded:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.MouseButton1 then
		StopTrackingMouse()
	end
end)

(specifically locate this)
for i, fountains in pairs(fountains) do

The code under this connects to this script in ServerScriptService:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ValueChanged = ReplicatedStorage:WaitForChild("ValueChanged")
local fountains = {
	workspace.RingBTMCenter.Fountain1.cannon.core.fountain,
	workspace.RingBTMCenter.Fountain2.cannon.core.fountain,
	workspace.RingBTMCenter.Fountain3.cannon.core.fountain,
	workspace.RingBTMCenter.Fountain4.cannon.core.fountain,
	workspace.RingBTMCenter.Fountain5.cannon.core.fountain,
	workspace.RingBTMCenter.Fountain6.cannon.core.fountain,
	workspace.RingBTMCenter.Fountain7.cannon.core.fountain,
	workspace.RingBTMCenter.Fountain8.cannon.core.fountain
}

ValueChanged.OnServerEvent:Connect(function()
	fountains.Speed = NumberRange.new(GetNewSpeed(newPosition))
end)

I don’t know if things are too messy after my changes, or I’m not doing the right method,
but if anyone could find out the issue, I would appreciate it greatly.

I don’t think you wanted to set a key of the fountains list?
Try this:

ValueChanged.OnServerEvent:Connect(function(player, rate)
    if player.UserId == game.CreatorId then
        for _, fountain in pairs(fountains) do
            fountain.Speed = NumberRange.new(rate)
        end
    else
        player:Kick("Invalid permissions.")
    end
end)