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)
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)
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.
2 comments
What is "string" supposed to be?
a string that the player says.