Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How come i get the error "attempt to concatenate string with Instance"??

So, For some reason. Everytime the "CurrentlyInfecting" Value changes, It gives the output: "attempt to concatenate string with Instance" and im so confused, Help??

local leaderstats = script.Parent.Parent.Parent.Parent.leaderstats
script.Parent.Parent.Parent.Parent.leaderstats.CurrentlyInfecting.Changed:Connect(function()
	script.Parent.Text = "Infected: ".. leaderstats.CurrentlyInfecting .."/"..leaderstats.MaxInfect
		print("Works")
end)

1 comment

0

Add .Value after "CurrentlyInfecting" and "MaxInfect" if they are values

1 answer

The error is pretty self-explanatory, your trying to concatenate a string with an instance. You cant do that because the instance it self is not a string (or number) so you will have to use some properties of the instance:

If its a value do as DeUltimate23 said, put a .Value on the end. If its a part or something like that put .Name on the end.

This discussion is preserved as it was. New answers, comments, and votes are closed.