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

attempt to concatenate local 's' (a table value)?

I am trying to set a value to something a player said

Here is my sad failed localscript

localscript:

P.Chatted:Connect(function(msg)
 local s = string
 if msg == ":add "..s then
 MapVal.Value = s
 end
end)

2 comments

0

What is "string" supposed to be?

0

a string that the player says.

1 answer

✓ Accepted answer

Without the quotes, 'string' isn't a string. To fix your code simply add quotes around the word string

P.Chatted:Connect(function(msg)
 local s = "string"
 if msg == ":add "..s then
 MapVal.Value = s
 end
end)

This code SHOULD add a value that the player typed:

P.Chatted:Connect(function(msg)
	local command = ":add "
	if string.sub(msg, 1, string.len(command)) == command then
		local addValue = string.sub(msg, string.len(command))
		MapVal.Value = addValue
	end
end)

-I didn't test it, if there are errors message me.

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