NEW VERSION: https://scriptinghelpers.org/questions/73462/why-wont-my-if-statement-read-my-string-value-answered
Why wont this work
1 | if game.ReplicatedStorage.MapLoader.Value = = "map1" then |
2 |
3 | print ( "Test" ) |
4 |
5 | end |
1 | if game.ReplicatedStorage.MapLoader.Value = = 1 then |
2 | print ( "Test" ) |
3 | end |
Sometimes it’s best if the if statement is less direct and more variable, although it works both ways. Try this anyway
1 | local ReplicatedStorage = game:GetService(“ReplicatedStorage”) --//more efficient method of indexing |
2 | local MapLoader = ReplicatedStorage:WaitForChild(“MapLoader”).Value --//helps to yield so the script doesn’t break or check f something is ‘nil’ |
3 |
4 | if (MapLoader = = 1 ) then |
5 | print (“Okay”) |
6 | end |
There are also things that could cause the issue, for instance, check if you accidentally disabled the script?