Ok so the problem is that the ServerScript can’t detect my NumberValue that is inside the player instance.
LocalScript:
-- This LocalScript gives every player a copy of the NumberValue stored under the player instance
local numberValue = game:GetService("ReplicatedStorage").NumberValue
numberValue.Parent = game.Players.LocalPlayer
ServerScript:
game.Players.PlayerAdded:Connect(function(player)
print("Test1") -- Prints successfully
local numberValue = player:WaitForChild("NumberValue") -- The code is stuck at this line because it cannot find the NumberValue inside the player instance
print("Test2") -- Does not print
print(numberValue.Value) -- Does not print
end)
local numberValue = game:GetService("ReplicatedStorage").NumberValue
game.Players.PlayerAdded:Connect(function(player)
print("Test1") -- Prints successfully
numberValue:Clone().Parent = player
local numberValue = player:WaitForChild("NumberValue") -- The code is stuck at this line because it cannot find the NumberValue inside the player instance
print("Test2") -- Does not print
print(numberValue.Value) -- Does not print
end)