You could instead send the data that you got from datastores, to identity the Unit the player has equipped. The other server could identity it just like the first server.
game:GetService("TeleportService").LocalPlayerArrivedFromTeleport:Connect(function(TeleportGui,DataTable)
wait(0.1)
print(1)
for i,v in pairs(DataTable) do
print(v)
print(2)
if game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").BuyCats.UnitSelect[tostring(v)] then
print(3)
if v.Value >= 1 then
print(4)
local Unit = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").BuyCats.UnitSelect[tostring(v)]
Unit.Shop.Disabled = true
Unit.Parent = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").YourCats.UnitSelect
wait(0.1)
local OwnedUnit = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").YourCats.UnitSelect:WaitForChild(tostring(Unit))
if OwnedUnit then
print(5)
OwnedUnit.LocalScript.Disabled = false
end
else
end
elseif game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").YourCats.Storage[tostring(v)] then
print(3)
if v.Value >= 1 then
print(4)
local Unit = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").YourCats.Storage[tostring(v)]
if Unit:FindFirstChild("Shop") then
print(4.5)
Unit.Shop.Disabled = true
end
Unit.Parent = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").YourCats.UnitSelect
wait(0.1)
local OwnedUnit = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").YourCats.UnitSelect:WaitForChild(tostring(Unit))
if OwnedUnit then
print(5)
OwnedUnit.LocalScript.Disabled = false
end
else
end
elseif game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").UnitGacha.Storage[tostring(v)] then
print(3)
if v.Value >= 1 then
print(4)
local Unit = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").UnitGacha.Storage[tostring(v)]
Unit.Parent = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").YourCats.UnitSelect
wait(0.1)
local OwnedUnit = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").YourCats.UnitSelect:WaitForChild(tostring(Unit))
if OwnedUnit then
print(5)
OwnedUnit.LocalScript.Disabled = false
end
else
end
end
end
end)
It only printed one value and stopped at this line:
if v.Value >= 1 then
EDIT: I did not have the Red cat (I’m doing all of this in a testing place so yeah) but it did not continue to the next one, which I have!
What do I do?
game:GetService("TeleportService").LocalPlayerArrivedFromTeleport:Connect(function(TeleportGui,DataTable)
wait(0.1)
print(1)
for i,v in pairs(DataTable) do
print(v)
print(2)
if game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").BuyCats.UnitSelect[tostring(v)] then
print(3)
if v:IsA("NumberValue") and v.Value >= 1 then
print(4)
local Unit = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").BuyCats.UnitSelect[tostring(v)]
Unit.Shop.Disabled = true
Unit.Parent = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").YourCats.UnitSelect
wait(0.1)
local OwnedUnit = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").YourCats.UnitSelect:WaitForChild(tostring(Unit))
if OwnedUnit then
print(5)
OwnedUnit.LocalScript.Disabled = false
end
else
end
elseif game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").YourCats.Storage[tostring(v)] then
print(3)
if v:IsA("NumberValue") and v.Value >= 1 then
print(4)
local Unit = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").YourCats.Storage[tostring(v)]
if Unit:FindFirstChild("Shop") then
print(4.5)
Unit.Shop.Disabled = true
end
Unit.Parent = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").YourCats.UnitSelect
wait(0.1)
local OwnedUnit = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").YourCats.UnitSelect:WaitForChild(tostring(Unit))
if OwnedUnit then
print(5)
OwnedUnit.LocalScript.Disabled = false
end
else
end
elseif game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").UnitGacha.Storage[tostring(v)] then
print(3)
if v:IsA("NumberValue") and v.Value >= 1 then
print(4)
local Unit = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").UnitGacha.Storage[tostring(v)]
Unit.Parent = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").YourCats.UnitSelect
wait(0.1)
local OwnedUnit = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainGui").YourCats.UnitSelect:WaitForChild(tostring(Unit))
if OwnedUnit then
print(5)
OwnedUnit.LocalScript.Disabled = false
end
else
end
end
end
end)
There is an open sourced module that converts the table into a variable and from there you could sent it to another script with RemoteEvents/Bindable functions:
Tried it out.
So I basically replaced if v.Value >= 1 with a remote event to access the server to check from there.
this is the replacement for that line!
local True = true
local repr = require(3148021300)
game.ReplicatedStorage.CheckValue.OnServerEvent:Connect(function(Player,v,DataTable)
print(repr(DataTable))
print(v)
if v:IsA("NumberValue") and v.Value >= 1 then
print(v.."Is available!")
game.ReplicatedStorage.CheckValue:FireClient(Player,True)
else
game.ReplicatedStorage.CheckValue:FireClient(Player)
end
end)