local Status = game.ReplicatedStorage.Status
local DuringRound = game.ReplicatedStorage.InRound.Value
DuringRound.PlayerAdded:Connect(function()
if DuringRound.Value == true then
local randommaps = maps[math.random(1,#maps)]
randommaps:Clone().Parent = workspace
local currentMap = randommaps.Name
print(randommaps.Name)
print("A map has been placed")
wait(3)
print("Players have been teleported to the map")
if currentMap == 'Map1' then
print("test1")
for _, Player in pairs(game.Players:GetChildren()) do
local character = Player.Character
character.HumanoidRootPart.CFrame = CFrame.new(Tele.Position)
print("test2")
print("Teleported to telel1")
end
end
True but I do see another one that could be a problem…
You defined DuringRound as the value of InRound, then you check if DuringRound.Value == true. That’s gonna cause problems because it’s gonna return an error similar to “Value is not a valid member of boolean.”
To fix that, don’t define DuringRound with it’s value. Define it as the instance itself:
local DuringRound = game.ReplicatedStorage.InRound
If I am correct, then this will also fix the error you intended us to fix. You most likely did DuringRound.Changed:Connect(function() and hence returning that error.
it doesn’t even state the line the error is coming from but this error happened after I did your corrections. (thank you for your response btw)
Code with the corrections made
‘’'lua
local Status = game.ReplicatedStorage.Status
local DuringRound = game.ReplicatedStorage.InRound
DuringRound.Changed:Connect(function()
if DuringRound.Value == true then
local randommaps = maps[math.random(1,#maps)]
randommaps:Clone().Parent = workspace
local currentMap = randommaps.Name
print(randommaps.Name)
print("A map has been placed")
wait(3)
print("Players have been teleported to the map")
if currentMap == 'Map1' then
print("test1")
for _, Player in pairs(game.Players:GetChildren()) do
local character = Player.Character
character.HumanoidRootPart.CFrame = CFrame.new(Tele.Position)
print("test2")
print("Teleported to telel1")
end
end
Sorry for the late response but you can always head to the error line by clicking on the red error message. Once you do so, please show me that line if you haven’t fixed it already.