Scripting a gui, don't understand error

I’m trying to make a script where if the value inputted is a number it says Correct, and otherwise an error message appears. I want to make the gui with a script, rather than pre-make it and just disable it. This is what I have so far

text:GetPropertyChangedSignal("Text"):Connect(function()
if tonumber(text.Text) then
	print("Correct")
else
	local screen = script.Parent.Parent
	local errorGui = Instance.new("TextLabel", screen)
	
	errorGui.Text = "Please enter a number between 1 and 5."
	errorGui.TextSize = "25"
	errorGui.BorderSizePixel = "5"
	errorGui.Position = UDim2.new(0.357,0,0.459,0)
	errorGui.Size = UDim2.new(0,370,0,0)
	end
end)

The error that appeared was require(assetId) cannot be called from a client. I don’t understand what the error means or how to fix it, could someone help me please?

1 Like

That error must’ve been from a different script then. Or you didn’t post your full code.

This kind of error only happens when you call require(id) in a LocalScript.
Are you sure the stack trace says this is the script that is erroring?

I didn’t think it was a problem with the whole script, but this is my only script. The whole thing looks like this

local text = script.Parent.numberValue
local upB = script.Parent.upButton
local downB = script.Parent.downButton

function onClickUp()
	if text.Text < "5" and text.Text >= "1" then
		text.Text = text.Text + "1"
	end
end

function onClickDown()
	if text.Text > "1" and text.Text <= "5" then
		text.Text = text.Text - "1"
	end
end

upB.MouseButton1Click:Connect(onClickUp)
downB.MouseButton1Click:Connect(onClickDown)

text:GetPropertyChangedSignal("Text"):Connect(function()
	if tonumber(text.Text) then
		print("Correct")
	else
		local screen = script.Parent.Parent
		local errorGui = Instance.new("TextLabel", screen)
		
		errorGui.Text = "Please enter a number between 1 and 5."
		errorGui.TextSize = "25"
		errorGui.BorderSizePixel = "5"
		errorGui.Position = UDim2.new(0.357,0,0.459,0)
		errorGui.Size = UDim2.new(0,370,0,0)
	end
end)

I don’t see any require calls here either.
Can you click the error message in the studio output and see which script is causing it?

If you’re absolutely sure that you don’t have any other scripts, it could be possible that the erroring script is a backdoor… but why would it use a LocalScript

If this is the only script in your game, then the error may be coming from a plugin you have installed.

It was talking about the Archimedes Plugin I have in the output, but it wasn’t apart of the error, which strangely enough, won’t appear anymore when I test it. I still have this issue though, the borderline of the gui goes through the text.
image

Either set the transparency to 1 or have the BorderSizePixel at 0

I’ve noticed that you used the parent argument of Instance.new on the errorGui variable which is pretty bad for performance, so I suggest to remove that and refrain from doing it, also put the .Parent assignment in the last field that you assign. If you want to know why make sure to read this post.

Also if someone already solved your issue make sure to mark the person’s post as the solution! :smile: