observeableValue undefined for summoning system

hello so im trying to make a summoning system for my tower defense game but it gives me this error in output “observableValue undefined” and I dont know why. Can anyone help?

Heres the local script I can provide the sever script if needed.

local player = game.Players.LocalPlayer
local mainGui = player.PlayerGui:WaitForChild("MainGui")
local mainEvent = game.ReplicatedStorage:WaitForChild("MainEvent")

function closeFrames()
	for i, v in pairs(mainGui:GetChildren()) do
		for i2,v2 in pairs(v:GetChildren()) do
			if v2:IsA("Frame") then
				v2.Visible = false
			end
		end
	end
end

mainGui.UnitsTextButton.MouseButton1Click:Connect(function()
	closeFrames()
	mainGui.UnitsTextButton.UnitsFrame.Visible = true
	
	for i,v in pairs(mainGui.UnitsTextButton.UnitsFrame.OwnedUnits:GetChildren()) do
		if v:IsA("TextButton") then
			v:Destroy()
		end
	end
	
	for i,v in pairs(player.OwnedUnits:GetChildren()) do
		local unitsTextButton = Instance.new("TextButton", mainGui.UnitsTextButton.UnitsFrame.OwnedUnits)
		unitsTextButton.Name = v.Name.."TextButton"
		unitsTextButton.Text = v.Name
		unitsTextButton.BackgroundColor3 = Color3.new(0, 1, 1)
		unitsTextButton.RichText = true
		unitsTextButton.FontFace.Bold = true
		unitsTextButton.TextScaled = true
	end
	
	mainGui.UnitsTextButton.UnitsFrame.CloseButton.MouseButton1Click:Connect(function()
		closeFrames()
		
		
	end)
end)

mainGui.SummonTextButton.MouseButton1Click:Connect(function()
	closeFrames()
	local summonFrame = mainGui.SummonTextButton.SummonFrame
	mainGui.SummonTextButton.SummonFrame.CratesFrame.CoinsTextLabel.Text = "Coins: "..player.leaderstats.Coins.Value
	summonFrame.Visible = true
	
	
	mainGui.SummonTextButton.SummonFrame.CloseButton.MouseButton1Click:Connect(function()
		closeFrames()
	end)
	
	summonFrame.CratesFrame.BasicCrate.MouseButton1Click:Connect(function()
		summonFrame.CratesFrame.BasicCrate.BackgroundColor3 = Color3.new(0.33, 1, 0)
		summonFrame.CratesFrame.MythicCrate.BackgroundColor3 = Color3.new(1, 0, 0)
	end)
	summonFrame.CratesFrame.MythicCrate.MouseButton1Click:Connect(function()
		summonFrame.CratesFrame.MythicCrate.BackgroundColor3 = Color3.new(0.33, 1, 0)
		summonFrame.CratesFrame.BasicCrate.BackgroundColor3 = Color3.new(1, 0, 0)
	end)
	
	summonFrame.CratesFrame.SummonButton.MouseButton1Click:Connect(function()
		for i,v in pairs(summonFrame.CratesFrame:GetChildren()) do
			if v:IsA("TextButton") then
				if v.BackgroundColor3 == Color3.new(0.33, 1, 0) then
					local crateName = string.split(v.Name, "TextButton")[1]
					
					mainEvent:FireServer("Summon", crateName)
				end
			end
		end
	end)
end)

mainEvent.OnClientEvent:Connect(function(eventType, argument1)
	if eventType == "Summon" then
		local summonedUnit = argument1
		local summonedTextLabel = mainGui.SummonTextButton.SummonFrame.CratesFrame.Summoned
		
		summonedTextLabel.Text = "You have summoned: "..summonedUnit
		mainGui.SummonTextButton.SummonFrame.CratesFrame.CoinsTextLabel.Text = "Coins: "..player.leaderstats.Coins.Value
	end
end)
2 Likes

Could we know what line it refers to in the error?

teeext

2 Likes

Forget what I said. It seems to be a bug with Roblox as of now.
It’s harmless, if not annoying, according to what I’ve read

2 Likes

It doesnt say which line it just says client

3 Likes


Heres the ouput line.

1 Like

As I said, shouldn’t cause any issues other than being annoying

2 Likes

Oh well I think its causing a issue this time because my script isnt working.

2 Likes

It’s a roblox bug; there isn’t anything you can do to fix it. Although it apparently conflicts with some engine behavior

1 Like

It’s possible the issue occurs elsewhere then. Try using print statements to determine if the function even runs to begin with.

1 Like

ok well what do you think is wrong with my script because its not working for summoning units

1 Like

yea I used print statments for my server script and my local and the print statments didnt show for the client script

1 Like

Well, I can’t deduce the case of that particular issue, I do see another one:

In this, you’re creating new event connections every time the SummonTextButton is clicked. This will create a memory leak as well as possibly spam your server:

If you click the main button more than once, and click the SummonButton more than once, this will fire the event a lot

1 Like

Seems like you’re a step closer to the script’s problem then! Revise your script and UI elements with the notion that the client doesn’t seem to pick up on anything.

P-S: Don’t parent things with the Instance.new function.

1 Like

It still didnt work. Would you like me to provide the server script.

1 Like

He didn’t say that was THE issue, but said this was AN issue. It creates a memory leak for when it DOES work

1 Like

this is not a problem with your script, it’s a Roblox issue, there’s a bug report about it already

1 Like

It’s a glitch, i’ve seen other people having it with both observableValues and PlayerAdded events.

1 Like