For some reason my map system which previously worked fine has stopped working. When I looked into it further, it seems that when it tries to compare two string values that apparently aren’t the same.
if v.Name == "Map_" .. value and v.Name ~= "Owner" then
For example, when I try and request to change to “Map_test”, the statement would return false:
-- v is "Map_test", value is a string, "test"
if v.Name == "Map_" .. value and v.Name ~= "Owner" then
-- returns false now?
You mention that you want to compare the value of the StringValue obj but you’re comparing its name twice? It can’t simultaneously be named “Owner” and “Map_”-something
Ah, I read that as a ‘==’ not a ‘~=’ operator. It’s difficult to diagnose this without looking at your code, or without you posting debug information of the values/names as the script fails.
Are you changing the names of these objects on the client by any chance and comparing them from the server? There are many, many reasons why this might fail. Highly recommend posting a debug log
--before this is to check whether the player can request a map change
for i,v in pairs(maps:GetDescendants()) do -- "maps" is a list containing two folders with StringValue's in them
if v:IsA("StringValue") then --check if it isn't the folder
if v.Name == "Map_" .. tostring(value) and v.Name ~= "Owner" then --the problem
if v.Parent.Name ~= "Special" or player.UserId == 73797133 then --check if the map can be requested
requestmap = v
RepS.SendServerMessage:FireAllClients("Map",tostring("Map_" .. value),player.Name) --update info
break
end
end
end
end
And no, this is being handled by the server, and information is collected from the Client using a RemoteEvent
I’m going to assume that no map is named Map_Owner? If not, just use :match method e.g.
if v.Name:match(value)
However, I have no idea what defines ‘value’ - you should do some sanity checks on what the player sends you. Similarly, it may be that the player is sending you a lowercase value and your StringValue name is punctuated, so you should do checks such as:
if v.Name:upper():match(value:upper()) then
and so forth. Again, would be easier to help you debug with debug info e.g. prints of what the value is, prints of what the ‘v’ object is via output
I am also having this issue, a script that compared strings that was working perfectly fine yesterday no longer works. Maybe something to do with the release of version 436?
When I print out the return values of the RemoteEvent:
print(player,changevalue,value) --changevalue is another value sent, but is not associated with the problem
print(typeof(player),typeof(changevalue),typeof(value))
Strange to see when value is infact returning a string, but concatenation seems to not work. I’ve tried using :match() and :upper(), and it doesn’t seem to solve the case.
Apparently the string system seems to be working again; perhaps Roblox fixed this issue, since I never modified the code. Interesting how this was a problem.