Does Values in ReplicatedStorage not change inside of a script when you change them manually?

Hello, I’ve been having a issue where in my game, whenever I want to manually on the server side change the value of the Spawning Time, it never changes how long it takes, and it always stays the same.

If I put this in Server Storage, will this not happen?

Script:

--//Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--//Variables
local Ball = ReplicatedStorage:WaitForChild("Objects"):WaitForChild("Ball")
local Parent = game.Workspace:FindFirstChild("BallSpawner")
local RespawnTime = ReplicatedStorage:WaitForChild("Values").RespawnTime.Value -- Respawn Time For the Balls

local RunService = game:GetService("RunService")

--//Controls
local Debounce = false

--//Loops

while true do
	local BallClone = Ball:Clone() 
	BallClone.CFrame = Parent.CFrame
	BallClone.Parent = workspace

	local V = BallClone:WaitForChild("LinearVelocity")
	
	if V == nil then
		local V = Instance.new("LinearVelocity", BallClone)
		V.Enabled = false
		
		local At = Instance.new("Attachment",BallClone)
	end

	task.wait(1)
	V.Enabled = true

	local X = math.random(-1, 1) * 15

	if X == 0 then
		V.VectorVelocity = Vector3.new(X, 0, math.random(-1, 1) * 15)
	else
		V.VectorVelocity = Vector3.new(X, 0, 0)
	end
	
	local StopVel = ReplicatedStorage:WaitForChild("ReplicatedScripts"):WaitForChild("StopVel"):Clone()
	StopVel.Parent = BallClone

	task.wait(RespawnTime)
end

The problem is that you reference the Value of the respawn time at the beginning and don’t ever update it. Just set it to the NumberValue itself and call RespawnTime.Value

--//Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--//Variables
local Ball = ReplicatedStorage:WaitForChild("Objects"):WaitForChild("Ball")
local Parent = game.Workspace:FindFirstChild("BallSpawner")
local RespawnTime = ReplicatedStorage:WaitForChild("Values").RespawnTime. -- Respawn Time For the Balls

local RunService = game:GetService("RunService")

--//Controls
local Debounce = false

--//Loops

while true do
	local BallClone = Ball:Clone() 
	BallClone.CFrame = Parent.CFrame
	BallClone.Parent = workspace

	local V = BallClone:WaitForChild("LinearVelocity")
	
	if V == nil then
		local V = Instance.new("LinearVelocity", BallClone)
		V.Enabled = false
		
		local At = Instance.new("Attachment",BallClone)
	end

	task.wait(1)
	V.Enabled = true

	local X = math.random(-1, 1) * 15

	if X == 0 then
		V.VectorVelocity = Vector3.new(X, 0, math.random(-1, 1) * 15)
	else
		V.VectorVelocity = Vector3.new(X, 0, 0)
	end
	
	local StopVel = ReplicatedStorage:WaitForChild("ReplicatedScripts"):WaitForChild("StopVel"):Clone()
	StopVel.Parent = BallClone

	task.wait(RespawnTime.Value)
end
1 Like