This is a script for changing the time in my game. When a script sends a value with the :FireServer() event, its suppost to change the time depending on the value in this script
RepStore = game:WaitForChild("ReplicatedStorage") --REPLICATED STORAGE
RepStore.Events.UI.ChangeLighting.OnServerEvent:connect(function(plr, Time) --BEGIN OF SCRIPT
print(Time)
--SUNRISE
if Time == string.lower("Sunrise") then
game.Lighting.TimeOfDay = "06:10:00"
print("[LIGHTING SYSTEM] - Successfully changed to Sunrise")
end
--DAY TIME
if Time == string.lower("Day") then
print("[LIGHTING SYSTEM] - Successfully changed to Day time")
game.Lighting.TimeOfDay = "12:00:00"
end
--SUNSET
if Time == string.lower("Sunset") then
print("[LIGHTING SYSTEM] - Successfully changed to Sunset")
game.Lighting.TimeOfDay = "18:00:00"
end
--NIGHT TIME
if Time == string.lower("Night") then
print("[LIGHTING SYSTEM] - Successfully changed to Night time")
game.Lighting.TimeOfDay = "00:30:00"
end
if Time ~=
string.lower("Sunset") or
string.lower("Day") or
string.lower("Night") or
string.lower("Sunrise") then
error("[LIGHTING SYSTEM] - Invalid Request: Does Not Exist")
end
end) --END OF SCRIPT
The problem is when I fire the server while testing from the command bar, it sends a player name instead of the value I requested, and the failsafe at the bottom saying its invalid. I want to send it a string value, but It never works
Command line: game.ReplicatedStorage.Events.UI.ChangeLighting:FireServer(Night)

5 comments
Have you tried putting Night in quotes? That could be the reason. Otherwise, the script sets it so that the string value must all be lowercase. Between line 4 and 5, try putting: Time = string.lower(Time).
I tried that, but that only fixes part of the problem. When I "game.ReplicatedStorage.Events.UI.ChangeLighting:FireServer("Night")", It sends my username, not my value, named Time
By the way instead of that failsafe being how it is, you could just write a elseif's with a final else being the error. It'll shorten your code a bit.
Can you print(plr) and see what that gives you in output? I'm for sure that client firing sends player name as the first argument but you did it correctly so it's a bit odd.
When I Do: "game.ReplicatedStorage.Events.UI.ChangeLighting:FireServer(plr, Night)", When It prints print(plr) and print(Time), it comes out as >Awesomewebm >nil