RemoteEvent doesn't see the value

When Value is true, it doesn’t see it. Value becomes true after clicking Textbutton.

local function demolation(plr)
	local char = plr.Character
	local plrgui = plr.PlayerGui.ScreenGui
	local maps = replicatedstorage:WaitForChild("Maps")
	local demolation = maps:WaitForChild("Demolation")
	local boolvalue = Instance.new("BoolValue")
	boolvalue.Name = "accept"
	boolvalue.Parent = plrgui
	plrgui.Frame.Timer.Text = "10"
	for i=1,10 do
		wait(1)
		plrgui.Frame.Timer.Text = i
	end
	plrgui.Frame.Visible = false
	if boolvalue.Value == true then
		local building = demolation.Building:Clone()
		building.Parent = workspace.mapstorage
	end
	
end

remotevents.Demolation.OnServerEvent:Connect(demolation)

Button Localscript

local scrngui = script.Parent.Parent.Parent
script.Parent.MouseButton1Click:Connect(function()
    local value = scrngui:WaitForChild("accept")
    value.Value = true
    script.Parent.Parent.Decline.Visible = false
end)

Because you set the value in a local script, the value is only true to the client. The server will see it as if the value never changed. Try setting the value in a server script.

1 Like

In filtering enabled, any client changes to server side objects will not replicate to the server. Assuming the screen gui is owned by the server here, the client cannot make this change. It will only show on the client side. The proper way to do this would be to fire an event to set the value to true on the server side instead of inside the gui.

1 Like