local function CreateRoom(map, gamemode, timeofday)
local template = script:FindFirstChild("ServerTemplate")
if not template then
warn("ServerTemplate not found")
return
end
local clone = template:Clone()
clone.Name = map.."_"..gamemode
if clone:FindFirstChild("Map") then
clone.Map.Text = map
end
if clone:FindFirstChild("Gamemode") then
clone.Gamemode.Text = gamemode
end
if clone:FindFirstChild("TimeOfDay") then
clone.TimeOfDay.Text = timeofday
end
clone.Parent = ServerListScroll
end```
trying to make a template be cloned but it just doesnt want to. (yes it kind of looks like AI i think)
#cloning template but doesnt want to?
1 messages · Page 1 of 1 (latest)
and yes everything is defined
but problem right now is that it just doesnt want to clone <:(
doesn't want to clone... as in clone.Name = map.."_"..gamemode returns an error due to clone being nil?
no cos the function returns
returns early?
its either throwing an error or its returning
if not template then
warn("ServerTemplate not found")
return
end
^^^^^^^
there's a huge difference between erroring and returning
no
u are dumb
he never said it warned him
what is template defined as, I'm assuming its a frame of sorts
yes
its a frame
and inside is stored a button and textlabels
you got a UIListLayout in there?
no
theres no scrolling frame
i assumed it was a scrolling frame
hey so i'm still waiting for your explanation as to how you magically could tell that the warning was in output
yep
bro is just hugely prejudiced rn
ur usin a lot of findfirstchilds
tbh
for already existing instances you know are gonna be there
you should probably jus use a waitforchild once at the top somewhere and the rest of the instances shouldnt have a problem loading before then
but
this is the original script
local function CreateRoom(map, gamemode, timeofday)
local template = script.ServerTemplate
local clone = template:Clone()
clone.Name = map.."_"..gamemode
--clone.Hoster.Text = player
clone.Map.Text = map
clone.Gamemode.Text = gamemode
clone.TimeOfDay.Text = timeofday
clone.Parent = ServerListScroll
end```
o
and define the arg types
map : string, gamemode: string, timeofday : number etc etc
so i know what information you're passing
and for this "list", it seems to have nowhere to actually go bro ngl
if it isnt a scrolling frame where is it going?
its no list tho
and is it even visible
can u show me the UI
on the screen
i could probably rewrite this in 2 mins bro ngl
gladly
i wanna learn the problem
so i dont cause in the future
i legit said ServerListScroll wasnt a scrolling frame
😭
mb
yeah
alr
thing is it would structure it
where are u calling this function
is it the event you sent in scripting before?
yes
okay can u do me a favour
its calling in a sc ript
add a print statement
?
under the event
yes
and check if it prints
once it receives it
and also show me the event sequence
cos there might be something wrong there
local function onGamemodeTeleportRequested(player, roomName, mapName, gamemodeName, timeofDayName)
print(("[MapTeleportHandler] Received teleport request from player %s for Map: '%s', Gamemode: '%s, Time of Day: %s'"):format(player.Name, tostring(mapName), tostring(gamemodeName), tostring(timeofDayName)))
print(roomName)
if not player.Character then
warn(("[MapTeleportHandler] Player %s (initiator) has no character. Teleport aborted."):format(player.Name))
return
end
local validPlayersToTeleport = {player}
local playerNamesToTeleport = {player.Name}
local targetPlaceId = nil
if mapName and gamemodeName and timeofDayName and placeTeleportConfig[mapName] and placeTeleportConfig[mapName][gamemodeName] then
targetPlaceId = placeTeleportConfig[mapName][gamemodeName][timeofDayName]
end
ServerSystem:FireClient(player, "CreateRoom", mapName, gamemodeName, timeofDayName)
if not targetPlaceId then
if mapName and placeTeleportConfig[mapName] then
warn(("[MapTeleportHandler] Map '%s' found, but Gamemode '%s' or Time of Day '%s' not configured for this map for player %s."):format(tostring(mapName), tostring(gamemodeName), tostring(timeofDayName), player.Name))
elseif mapName then
warn(("[MapTeleportHandler] Map '%s' not found in configuration for player %s."):format(tostring(mapName), player.Name))
else
warn(("[MapTeleportHandler] Invalid mapName or gamemodeName received. Map: '%s', Gamemode: '%s', Time of Day: '%s'. Teleport aborted."):format(tostring(mapName), tostring(gamemodeName), tostring(timeofDayName)))
end
return
end
local success, errorMessage = pcall(function()
TeleportService:Teleport(targetPlaceId, player)
end)
if not success then
warn(("[MapTeleportHandler] Failed to teleport player %s to PlaceId %s. Error: %s"):format(player.Name, tostring(targetPlaceId), errorMessage))
end
end```
this is where its calling it from
holly
ServerSystem.OnClientEvent:Connect(function(player, actionType, ...)
if actionType == "CreateRoom" then
CreateRoom(...)
end
end)```
here u go
o
yeah lol dw its a common mistake
noice
glad i could be of some help