Value not changing

This script somehow doesn’t work and I don’t know what’s wrong with it. the number values changes to 0, but the player values doesn’t change. It doesn’t print the name too. I’ve tried several things like changing GetChildren() to GetDescendants() and putting a variable in the parentheses but it still doesn’t work. There is nothing in the output btw.

local remote7 = game.ReplicatedStorage.RemoteEventTest7

remote7.OnServerEvent:Connect(function(player, number, number2)
	number.Value = 0
	number2.Value = 0
	local plr = game.ReplicatedStorage.Values.Players
	for i, v in pairs(plr:GetChildren()) do
		print(v.Name)
		v.Value = false
	end
end)
1 Like

Can you show the script that has the fire server command in it?

Yes, this is where it’s located btw.

And this is the script

local events = game.ReplicatedStorage.Events:GetChildren()
local event = game.ReplicatedStorage.Events
local text1 = script.Parent.TextLabel
local text2 = script.Parent.TextLabel2
local button1 = script.Parent.TextButton
local button2 = script.Parent.TextButton2
local remote = game.ReplicatedStorage.RemoteEventTest
local values = game.ReplicatedStorage.Values
local number = values.Number
local number2 = values.Number2
local bool = values.Bool
local player = game.Players.LocalPlayer
local plr = values.Players
local remote2 = game.ReplicatedStorage.RemoteEventTest2
local remote3 = game.ReplicatedStorage.RemoteEventTest3
local remote4 = game.ReplicatedStorage.RemoteEventTest4
local remote5 = game.ReplicatedStorage.RemoteEventTest5
local remote6 = game.ReplicatedStorage.RemoteEventTest6
local remote7 = game.ReplicatedStorage.RemoteEventTest7
--~

while true do
	remote:FireServer(events)
	remote6:FireServer(text1, text2)
	button1.MouseButton1Click:Connect(function()
		if plr:FindFirstChild(player.Name).Value == false then
			plr:FindFirstChild(player.Name).Value = true
			remote2:FireServer()
		end
	end)
	button2.MouseButton1Click:Connect(function()
		if plr:FindFirstChild(player.Name).Value == false then
			plr:FindFirstChild(player.Name).Value = true
			remote3:FireServer()
		end
	end)
	wait(10)
	script.Parent.Visible = false
	remote4:FireServer(number, number2, text1, text2, event)
	wait(10)
	remote7:FireServer(number, number2)
	script.Parent.Visible = true
end

Maybe add a .Changed function inside both MouseButton1Click functions. The if-statement should go inside it. Edit: Apologies for such a late reply.

1 Like