Spawnplayers.OnClientEvent:Connect(function()
task.wait(0.05)
for _, v in pairs(workspace.CurrentMap:GetChildren()) do
print(v.Name)
currentmap=v--v is the map
end
end)
obj.OnClientEvent:Connect(function()
task.wait(0.05)
if currentmap.Name=="Maze" then--error
main.Visible=true
main.Text.Text="Find the powerboxes and turn it on"
num.Text=tostring(objnumvalue.Value).."/4"
main:TweenPosition(UDim2.new(0.624,0,0.028,0), "Out", "Quad", 0.5)
objnumvalue.Changed:Connect(function()
num.Text=tostring(objnumvalue.Value).."/4"
end)
elseif currentmap.Name=="Backrooms" then--error
main.Visible=true
print("BACKROOMS OBJ RECIEVED")
main.Text.Text="Find the generator and turn it on."
num.Text=""
main:TweenPosition(UDim2.new(0.624,0,0.028,0), "Out", "Quad", 0.5)
end
end)
objcom.OnClientEvent:Connect(function()
num.Text="OBJECTIVE COMPLETED."
task.wait(1)
main:TweenPosition(UDim2.new(0.624,0,-1,0), "Out", "Quad", 0.5)
main.Visible=false
end)
CurrentMap is a folder inside workspace that stores current maps that are used in the round.
remoteevents work fine, but the error was : Attempt to index nil with “Name”.
The loop works fine on serverscripts, and this is a localscript and the loop does not work. It also does not print (v.Name). So idk what should I do.