#My data is not working!
1 messages · Page 1 of 1 (latest)
local TeleportService = game:GetService("TeleportService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local teleportData = TeleportService:GetLocalPlayerTeleportData()
if teleportData and teleportData.EquippedCookie then
local equippedCookie = teleportData.EquippedCookie
print("✅ Found cookie from teleport:", equippedCookie)
local remote = ReplicatedStorage:WaitForChild("CookieTeleported")
remote:FireServer(equippedCookie)
else
warn("❌ No teleport data found for player:", player.Name)
end
this is the local script that i use to retrieve data.
game.ReplicatedStorage.CookieTeleported.OnServerEvent:Connect(function(player, cookie)
if cookie then
player:SetAttribute("EquippedCookie", cookie)
print("✅", player.Name, "arrived with cookie:", cookie)
-- Optional: morph them immediately
local MorphModule = require(game.ReplicatedStorage:WaitForChild("MorphModule"))
MorphModule.Morph(player, cookie)
else
warn("❌ No cookie received for player", player.Name)
end
end)
this is the server script i use to retrieve data
local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MaxPlayersPerMatch = 12
local CountdownTime = 20
local matchmakingQueue = {}
local countdownRunning = false
local teleportInProgress = false
-- Create RemoteEvent to join matchmaking
local joinMatchmaking = Instance.new("RemoteEvent")
joinMatchmaking.Name = "JoinMatchmaking"
joinMatchmaking.Parent = ReplicatedStorage
joinMatchmaking.OnServerEvent:Connect(function(player)
if teleportInProgress then return end
if table.find(matchmakingQueue, player) then return end
table.insert(matchmakingQueue, player)
print(player.Name .. " joined matchmaking! ("..#matchmakingQueue.." in queue)")
if #matchmakingQueue >= 1 and not countdownRunning then
countdownRunning = true
print("⏳ Starting countdown...")
for i = CountdownTime, 1, -1 do
wait(1)
if #matchmakingQueue >= MaxPlayersPerMatch then
break
end
end
if #matchmakingQueue >= 2 then
local playersToTeleport = {}
for i = 1, math.min(#matchmakingQueue, MaxPlayersPerMatch) do
table.insert(playersToTeleport, matchmakingQueue[i])
end
-- Remove teleported players from queue
for _, p in ipairs(playersToTeleport) do
table.remove(matchmakingQueue, table.find(matchmakingQueue, p))
end
-- 🧠 CREATE TELEPORT DATA
local teleportData = {}
for _, player in ipairs(playersToTeleport) do
local cookie = player:GetAttribute("EquippedCookie")
if cookie then
teleportData[player.UserId] = {
EquippedCookie = cookie
}
print("✔️ Sending", player.Name, "with cookie:", cookie)
else
warn("⚠️ Player", player.Name, "has no EquippedCookie attribute!")
end
end
-- 🚪 Teleport to reserved battle server
teleportInProgress = true
local matchPlaceId = 104903663199299
local reservedCode = TeleportService:ReserveServer(matchPlaceId)
local success, err = pcall(function()
TeleportService:TeleportToPrivateServer(matchPlaceId, reservedCode, playersToTeleport, nil, teleportData)
end)
if not success then
warn("🚨 Teleport failed:", err)
end
teleportInProgress = false
countdownRunning = false
else
countdownRunning = false
end
end
end)
-- Remove player from queue if they leave
Players.PlayerRemoving:Connect(function(player)
local index = table.find(matchmakingQueue, player)
if index then
table.remove(matchmakingQueue, index)
end
end)
that is the sending data.
AI ahhh code
anyways
i need colors
im autistic
-- 🧠 CREATE TELEPORT DATA
local teleportData = {}
for _, player in ipairs(playersToTeleport) do
local cookie = player:GetAttribute("EquippedCookie")
if cookie then
teleportData[player.UserId] = {
EquippedCookie = cookie
}
print("✔️ Sending", player.Name, "with cookie:", cookie)
else
warn("⚠️ Player", player.Name, "has no EquippedCookie attribute!")
end
end
-- 🚪 Teleport to reserved battle server
teleportInProgress = true
local matchPlaceId = 104903663199299
local reservedCode = TeleportService:ReserveServer(matchPlaceId)
local success, err = pcall(function()
TeleportService:TeleportToPrivateServer(matchPlaceId, reservedCode, playersToTeleport, nil, teleportData)
end)
if not success then
warn("🚨 Teleport failed:", err)
end
teleportInProgress = false
countdownRunning = false
else
countdownRunning = false
end
end
end)
-- Remove player from queue if they leave
Players.PlayerRemoving:Connect(function(player)
local index = table.find(matchmakingQueue, player)
if index then
table.remove(matchmakingQueue, index)
end
end)
shit
why no color
lua ```
-- 🧠 CREATE TELEPORT DATA
local teleportData = {}
for _, player in ipairs(playersToTeleport) do
local cookie = player:GetAttribute("EquippedCookie")
if cookie then
teleportData[player.UserId] = {
EquippedCookie = cookie
}
print("✔️ Sending", player.Name, "with cookie:", cookie)
else
warn("⚠️ Player", player.Name, "has no EquippedCookie attribute!")
end
end
-- 🚪 Teleport to reserved battle server
teleportInProgress = true
local matchPlaceId = 104903663199299
local reservedCode = TeleportService:ReserveServer(matchPlaceId)
local success, err = pcall(function()
TeleportService:TeleportToPrivateServer(matchPlaceId, reservedCode, playersToTeleport, nil, teleportData)
end)
if not success then
warn("🚨 Teleport failed:", err)
end
teleportInProgress = false
countdownRunning = false
else
countdownRunning = false
end
end
end)
-- Remove player from queue if they leave
Players.PlayerRemoving:Connect(function(player)
local index = table.find(matchmakingQueue, player)
if index then
table.remove(matchmakingQueue, index)
end
end)
someone help
-- 🧠 CREATE TELEPORT DATA
local teleportData = {}
for _, player in ipairs(playersToTeleport) do
local cookie = player:GetAttribute("EquippedCookie")
if cookie then
teleportData[player.UserId] = {
EquippedCookie = cookie
}
print("✔️ Sending", player.Name, "with cookie:", cookie)
else
warn("⚠️ Player", player.Name, "has no EquippedCookie attribute!")
end
end
-- 🚪 Teleport to reserved battle server
teleportInProgress = true
local matchPlaceId = 104903663199299
local reservedCode = TeleportService:ReserveServer(matchPlaceId)
local success, err = pcall(function()
TeleportService:TeleportToPrivateServer(matchPlaceId, reservedCode, playersToTeleport, nil, teleportData)
end)
if not success then
warn("🚨 Teleport failed:", err)
end
teleportInProgress = false
countdownRunning = false
else
countdownRunning = false
end
end
end)
-- Remove player from queue if they leave
Players.PlayerRemoving:Connect(function(player)
local index = table.find(matchmakingQueue, player)
if index then
table.remove(matchmakingQueue, index)
end
end)
there we go
okay after
consulting
with profound proffesor
Dr. Suggon Deez Nuts
i have came to the conclusion that
chat gpt made correct code
yea dont tell no one shhh