I am trying to make an “edit game” type script and I am trying to make it detect if the player is editing and prints if it got detected, but it doesn’t work. Here is the lobby server script:
elseif action == "play" or action == "edit" then
if player:GetAttribute("IsTeleporting") then return end
player:SetAttribute("IsTeleporting", true)
local gameEntry = findGame(player.UserId, gameId)
if not gameEntry then player:SetAttribute("IsTeleporting", nil) return end
if not gameEntry.PrivateServerCode then
local ok, code
ok, code = pcall(function()
return TeleportService:ReserveServer(placeId)
end)
if ok and code then
gameEntry.PrivateServerCode = code
else
player:SetAttribute("IsTeleporting", nil)
return
end
end
local spawnData = {}
if action == "edit" then
spawnData.EditMode = true
end
local success, err = pcall(function()
TeleportService:TeleportToPrivateServer(placeId, gameEntry.PrivateServerCode, {player}, spawnData)
end)
task.delay(5, function()
if player and player.Parent then
player:SetAttribute("IsTeleporting", nil)
end
end)
Editing game server script:
game.Players.PlayerAdded:Connect(function(player)
local joinData = player:GetJoinData()
if joinData.SpawnData and joinData.SpawnData.EditMode then
print("Player is in edit mode")
end
end)
