I am making a map gamemode system where if the map is named a certain thing then the gamemode is set to a certain one.
if chosenmap.Value == “Swampy Lands” or “Low-Poly City” or “Library” then
gamemode.Value = “Solo”
elseif chosenmap.Value == “Dredge” or “Imagine Beach” or “Vacation” then
gamemode.Value = “Teams”
else
gamemode.Value = “”
print(“Unkown map chosen can’t decide gamemode.”)
end
print(chosenmap.Value)
print(gamemode.Value)
It does print the acrorect map but when it prints gamemode its always stuck on solo anyone know why? When the map is on teams and teams should be set its still solo
Then chosenmap.Value isn’t matching the string values being checked in the script. Is chosenmap an ObjectValue instance? Because if it is then this won’t work.
local chosenmap = winner.Value
textstring.Value = textphrase2
if not winner.Value then
print("Something went wrong!")
break
end
local map = chosenmap.Value
clonemap = map:Clone()
print("Getting map...")
wait(1)
print("Getting map spawn...")
if clonemap.Spawns.SpawnLocation then
print("Success!")
else
print("Task failed successfully")
wait()
print("Restarting...")
clonemap:Destroy()
break
end
if table.find(soloMaps, chosenmap.Value) then
gamemode.Value = "Solo"
elseif table.find(teamMaps, chosenmap.Value) then
gamemode.Value = "Teams"
else
gamemode.Value = ""
end
print(chosenmap.Value)
print(gamemode.Value)
Yeah, so chosenmap is an ObjectValue instance (its value, if one exists, is a reference to some object, in this case a map).
if table.find(soloMaps, chosenmap.Value.Name) then
gamemode.Value = "Solo"
elseif table.find(teamMaps, chosenmap.Value.Name) then
gamemode.Value = "Teams"
else
gamemode.Value = ""
end
You’ll need the value of the “Name” property of the instance (which is a string value).