My script handles many datastores and it throttles as soon as I join the game, and multiple times throughout the play session. Also upon leaving. Here is my script:
local DataStoreService = game:GetService("DataStoreService")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local playerDataStore = DataStoreService:GetDataStore("PlayerData_V36")
local rupeesStore = DataStoreService:GetOrderedDataStore("RupeesLeaderboard")
local callsStore = DataStoreService:GetOrderedDataStore("CallsLeaderboard")
local callCentersStore = DataStoreService:GetOrderedDataStore("CallCentersLeaderboard")
local assignedPlots = {}
local tier2AssignedPlots = {}
local tier3AssignedPlots = {}
local tier4AssignedPlots = {}
local VIP_GAMEPASS_ID = 1226680892
local freeUnlockMap = {
unlockRoomPart = "baljeetRoomDoor",
unlockRoom2Part = "office1Door",
unlockRoom3Part = "office2Door",
unlock2ndFloorPart = "2ndFloorDoor",
unlock3rdFloorPart = "3rdFloorDoor"
}
local tier2FreeUnlockMap = {
unlockRoomPart = "RoomDoor",
frontDoorPart = "frontDoorModel"
}
local function updateRupeesLeaderboard(plr, value)
pcall(function()
rupeesStore:SetAsync(tostring(plr.UserId), value)
end)
end
local function updateCallsLeaderboard(plr, value)
pcall(function()
callsStore:SetAsync(tostring(plr.UserId), value)
end)
end
local function updateCallCentersLeaderboard(plr, value)
pcall(function()
callCentersStore:SetAsync(tostring(plr.UserId), value)
end)
end
local function savePlayerPlotObjects(plr, plotName)
local workspacePlot = workspace:FindFirstChild(plotName)
local replicatedPlot = game.ReplicatedStorage:FindFirstChild(plotName)
local dataToSave = {}
if workspacePlot then
for _, model in ipairs(workspacePlot:GetChildren()) do
if model:FindFirstChild("buyable") then
table.insert(dataToSave, model.Name)
end
end
end
if replicatedPlot then
for _, doorName in pairs(freeUnlockMap) do
if replicatedPlot:FindFirstChild(doorName) then
table.insert(dataToSave, doorName)
end
end
end
pcall(function()
playerDataStore:SetAsync("Plot_" .. plr.UserId, dataToSave)
end)
end
local function saveTier2PlotObjects(plr, plotName)
local workspacePlot = workspace:FindFirstChild(plotName)
local replicatedPlot = game.ReplicatedStorage:FindFirstChild(plotName)
local dataToSave = {}
if workspacePlot then
for _, model in ipairs(workspacePlot:GetChildren()) do
if model:FindFirstChild("buyable") then
table.insert(dataToSave, model.Name)
end
end
end
if replicatedPlot then
for _, doorName in pairs(tier2FreeUnlockMap) do
if replicatedPlot:FindFirstChild(doorName) then
table.insert(dataToSave, doorName)
end
end
end
pcall(function()
playerDataStore:SetAsync("tier2Plot_" .. plr.UserId, dataToSave)
end)
end
local function saveTier3PlotObjects(plr, plotName)
local workspacePlot = workspace:FindFirstChild(plotName)
local replicatedPlot = game.ReplicatedStorage:FindFirstChild(plotName)
local dataToSave = {}
if workspacePlot then
for _, model in ipairs(workspacePlot:GetChildren()) do
if model:FindFirstChild("buyable") then
table.insert(dataToSave, model.Name)
end
end
end
pcall(function()
playerDataStore:SetAsync("tier3Plot_" .. plr.UserId, dataToSave)
end)
end
local function saveTier4PlotObjects(plr, plotName)
local workspacePlot = workspace:FindFirstChild(plotName)
local replicatedPlot = game.ReplicatedStorage:FindFirstChild(plotName)
local dataToSave = {}
if workspacePlot then
for _, model in ipairs(workspacePlot:GetChildren()) do
if model:FindFirstChild("buyable") then
table.insert(dataToSave, model.Name)
end
end
end
pcall(function()
playerDataStore:SetAsync("tier4Plot_" .. plr.UserId, dataToSave)
end)
end
local function loadPlayerPlotObjects(plr, plotName)
local success, data = pcall(function()
return playerDataStore:GetAsync("Plot_" .. plr.UserId)
end)
if not success or not data then return end
local sourceFolder = game.ReplicatedStorage:FindFirstChild(plotName)
local destination = workspace:FindFirstChild(plotName)
if not sourceFolder or not destination then return end
for _, modelName in ipairs(data) do
local original = sourceFolder:FindFirstChild(modelName)
if original then
local clone = original:Clone()
clone.Parent = destination
end
end
for _, part in ipairs(destination:GetDescendants()) do
if part:IsA("BasePart") and part.Name == "BuyPart" then
local modelNameValue = part:FindFirstChild("modelName")
if modelNameValue and table.find(data, modelNameValue.Value) then
part.Parent = game.ReplicatedStorage:FindFirstChild(plotName)
end
end
end
for buttonName, doorName in pairs(freeUnlockMap) do
if destination:FindFirstChild(doorName) and table.find(data, doorName) then
destination[doorName].Parent = sourceFolder
if destination:FindFirstChild(buttonName) then
destination[buttonName].Parent = sourceFolder
end
end
end
end
local function loadTier2PlayerPlotObjects(plr, plotName)
local success, data = pcall(function()
return playerDataStore:GetAsync("tier2Plot_" .. plr.UserId)
end)
if not success or not data then return end
local sourceFolder = game.ReplicatedStorage:FindFirstChild(plotName)
local destination = workspace:FindFirstChild(plotName)
if not sourceFolder or not destination then return end
for _, modelName in ipairs(data) do
local original = sourceFolder:FindFirstChild(modelName)
if original then
local clone = original:Clone()
clone.Parent = destination
end
end
for _, part in ipairs(destination:GetDescendants()) do
if part:IsA("BasePart") and part.Name == "BuyPart" then
local modelNameValue = part:FindFirstChild("modelName")
if modelNameValue and table.find(data, modelNameValue.Value) then
part.Parent = game.ReplicatedStorage:FindFirstChild(plotName)
end
end
end
for buttonName, doorName in pairs(tier2FreeUnlockMap) do
if destination:FindFirstChild(doorName) and table.find(data, doorName) then
destination[doorName].Parent = sourceFolder
if destination:FindFirstChild(buttonName) then
destination[buttonName].Parent = sourceFolder
end
end
end
end
local function loadTier3PlayerPlotObjects(plr, plotName)
local success, data = pcall(function()
return playerDataStore:GetAsync("tier3Plot_" .. plr.UserId)
end)
if not success or not data then return end
local sourceFolder = game.ReplicatedStorage:FindFirstChild(plotName)
local destination = workspace:FindFirstChild(plotName)
if not sourceFolder or not destination then return end
for _, modelName in ipairs(data) do
local original = sourceFolder:FindFirstChild(modelName)
if original then
local clone = original:Clone()
clone.Parent = destination
end
end
for _, part in ipairs(destination:GetDescendants()) do
if part:IsA("BasePart") and part.Name == "BuyPart" then
local modelNameValue = part:FindFirstChild("modelName")
if modelNameValue and table.find(data, modelNameValue.Value) then
part.Parent = game.ReplicatedStorage:FindFirstChild(plotName)
end
end
end
end
local function loadTier4PlayerPlotObjects(plr, plotName)
local success, data = pcall(function()
return playerDataStore:GetAsync("tier4Plot_" .. plr.UserId)
end)
if not success or not data then return end
local sourceFolder = game.ReplicatedStorage:FindFirstChild(plotName)
local destination = workspace:FindFirstChild(plotName)
if not sourceFolder or not destination then return end
for _, modelName in ipairs(data) do
local original = sourceFolder:FindFirstChild(modelName)
if original then
local clone = original:Clone()
clone.Parent = destination
end
end
for _, part in ipairs(destination:GetDescendants()) do
if part:IsA("BasePart") and part.Name == "BuyPart" then
local modelNameValue = part:FindFirstChild("modelName")
if modelNameValue and table.find(data, modelNameValue.Value) then
part.Parent = game.ReplicatedStorage:FindFirstChild(plotName)
end
end
end
end
Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr
local Rupees = Instance.new("NumberValue")
Rupees.Name = "Rupees"
Rupees.Parent = leaderstats
local Calls = Instance.new("NumberValue")
Calls.Name = "Calls"
Calls.Parent = leaderstats
local CallCenters = Instance.new("NumberValue")
CallCenters.Name = "Call Centers"
CallCenters.Parent = leaderstats
local completedIntro = Instance.new("BoolValue")
completedIntro.Name = "completedIntro"
completedIntro.Parent = plr
local plotAssigned = Instance.new("StringValue")
plotAssigned.Name = "plotAssigned"
plotAssigned.Parent = plr
local tier2PlotAssigned = Instance.new("StringValue")
tier2PlotAssigned.Name = "tier2PlotAssigned"
tier2PlotAssigned.Parent = plr
local tier2Unlocked = Instance.new("BoolValue")
tier2Unlocked.Name = "tier2Unlocked"
tier2Unlocked.Parent = plr
local trialTukTukActivated = Instance.new("BoolValue")
trialTukTukActivated.Name = "trialTukTukActivated"
trialTukTukActivated.Parent = plr
local tier3Unlocked = Instance.new("BoolValue")
tier3Unlocked.Name = "tier3Unlocked"
tier3Unlocked.Parent = plr
local tier3PlotAssigned = Instance.new("StringValue")
tier3PlotAssigned.Name = "tier3PlotAssigned"
tier3PlotAssigned.Parent = plr
local trialTukTukActivated2 = Instance.new("BoolValue")
trialTukTukActivated2.Name = "trialTukTukActivated2"
trialTukTukActivated2.Parent = plr
local trialTukTukActivated3 = Instance.new("BoolValue")
trialTukTukActivated3.Name = "trialTukTukActivated3"
trialTukTukActivated3.Parent = plr
local tier4Unlocked = Instance.new("BoolValue")
tier4Unlocked.Name = "tier4Unlocked"
tier4Unlocked.Parent = plr
local tier4PlotAssigned = Instance.new("StringValue")
tier4PlotAssigned.Name = "tier4PlotAssigned"
tier4PlotAssigned.Parent = plr
local success, data = pcall(function()
return playerDataStore:GetAsync(plr.UserId)
end)
if success and data then
Rupees.Value = data.Rupees or 0
Calls.Value = data.Calls or 0
CallCenters.Value = data.CallCenters or 0
completedIntro.Value = data.completedIntro or false
tier2Unlocked.Value = data.tier2Unlocked or false
tier3Unlocked.Value = data.tier3Unlocked or false
trialTukTukActivated.Value = data.trialTukTukActivated or false
trialTukTukActivated2.Value = data.trialTukTukActivated2 or false
trialTukTukActivated3.Value = data.trialTukTukActivated3 or false
tier4Unlocked.Value = data.tier4Unlocked or false
else
Rupees.Value = 0
Calls.Value = 0
CallCenters.Value = 0
completedIntro.Value = false
tier2Unlocked.Value = false
tier3Unlocked.Value = false
trialTukTukActivated.Value = false
trialTukTukActivated2.Value = false
trialTukTukActivated3.Value = false
tier4Unlocked.Value = false
end
local successVip, hasPass = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(plr.UserId, VIP_GAMEPASS_ID)
end)
tier2Unlocked.Changed:Connect(function(val)
pcall(function()
playerDataStore:SetAsync(plr.UserId, {
tier2Unlocked = val,
Calls = Calls.Value,
CallCenters = CallCenters.Value,
completedIntro = completedIntro.Value
})
end)
end)
tier3Unlocked.Changed:Connect(function(val)
pcall(function()
playerDataStore:SetAsync(plr.UserId, {
tier3Unlocked = val,
Calls = Calls.Value,
CallCenters = CallCenters.Value,
completedIntro = completedIntro.Value
})
end)
end)
tier4Unlocked.Changed:Connect(function(val)
pcall(function()
playerDataStore:SetAsync(plr.UserId, {
tier4Unlocked = val,
Calls = Calls.Value,
CallCenters = CallCenters.Value,
completedIntro = completedIntro.Value
})
end)
end)
trialTukTukActivated.Changed:Connect(function(val)
pcall(function()
playerDataStore:SetAsync(plr.UserId, {
trialTukTukActivated = val,
Calls = Calls.Value,
CallCenters = CallCenters.Value,
completedIntro = completedIntro.Value
})
end)
end)
trialTukTukActivated2.Changed:Connect(function(val)
pcall(function()
playerDataStore:SetAsync(plr.UserId, {
trialTukTukActivated2 = val,
Calls = Calls.Value,
CallCenters = CallCenters.Value,
completedIntro = completedIntro.Value
})
end)
end)
trialTukTukActivated3.Changed:Connect(function(val)
pcall(function()
playerDataStore:SetAsync(plr.UserId, {
trialTukTukActivated3 = val,
Calls = Calls.Value,
CallCenters = CallCenters.Value,
completedIntro = completedIntro.Value
})
end)
end)
completedIntro.Changed:Connect(function(val)
pcall(function()
playerDataStore:SetAsync(plr.UserId, {
Rupees = Rupees.Value,
Calls = Calls.Value,
CallCenters = CallCenters.Value,
completedIntro = val
})
end)
end)
for i = 1, 5 do
if not assignedPlots[i] then
assignedPlots[i] = plr
local plotName = "plot" .. i
plotAssigned.Value = plotName
local plotPart = workspace:FindFirstChild(plotName)
if plotPart then
local label = plotPart:FindFirstChild("plotOwnerPart") and plotPart.plotOwnerPart:FindFirstChild("BillboardGui")
if label and label:FindFirstChild("TextLabel") then
label.TextLabel.Text = plr.Name .. "'s Call Center"
end
end
break
end
end
for i = 1, 5 do
if not tier2AssignedPlots[i] then
tier2AssignedPlots[i] = plr
local plotName = "tier2Plot" .. i
tier2PlotAssigned.Value = plotName
local plotPart = workspace:FindFirstChild(plotName)
break
end
end
for i = 1, 5 do
if not tier3AssignedPlots[i] then
tier3AssignedPlots[i] = plr
local plotName = "tier3Plot" .. i
tier3PlotAssigned.Value = plotName
local plotPart = workspace:FindFirstChild(plotName)
break
end
end
for i = 1, 5 do
if not tier4AssignedPlots[i] then
tier4AssignedPlots[i] = plr
local plotName = "tier4Plot" .. i
tier4PlotAssigned.Value = plotName
local plotPart = workspace:FindFirstChild(plotName)
break
end
end
if plr.Name == plr.Name then
loadPlayerPlotObjects(plr, plotAssigned.Value)
wait(3)
loadTier2PlayerPlotObjects(plr, tier2PlotAssigned.Value)
wait(3)
loadTier3PlayerPlotObjects(plr, tier3PlotAssigned.Value)
wait(3)
loadTier4PlayerPlotObjects(plr, tier4PlotAssigned.Value)
end
plr.AncestryChanged:Connect(function()
if not plr:IsDescendantOf(game) and plotAssigned.Value ~= "" then
local plotNum = tonumber(string.sub(plotAssigned.Value, 5))
if plotNum then
assignedPlots[plotNum] = nil
end
end
end)
plr.AncestryChanged:Connect(function()
if not plr:IsDescendantOf(game) and tier2PlotAssigned.Value ~= "" then
local plotNum = tonumber(string.sub(tier2PlotAssigned.Value, 5))
if plotNum then
tier2AssignedPlots[plotNum] = nil
end
end
end)
plr.AncestryChanged:Connect(function()
if not plr:IsDescendantOf(game) and tier3PlotAssigned.Value ~= "" then
local plotNum = tonumber(string.sub(tier3PlotAssigned.Value, 5))
if plotNum then
tier3AssignedPlots[plotNum] = nil
end
end
end)
plr.AncestryChanged:Connect(function()
if not plr:IsDescendantOf(game) and tier4PlotAssigned.Value ~= "" then
local plotNum = tonumber(string.sub(tier4PlotAssigned.Value, 5))
if plotNum then
tier4AssignedPlots[plotNum] = nil
end
end
end)
wait(5)
if tier2Unlocked.Value == true then
game.Workspace:FindFirstChild(tier2PlotAssigned.Value).plotOwnerPart.BillboardGui.TextLabel.Text = plr.Name.."'s Call Center"
end
if tier3Unlocked.Value == true then
game.Workspace:FindFirstChild(tier3PlotAssigned.Value).plotOwnerPart.BillboardGui.TextLabel.Text = plr.Name.."'s Call Center"
end
if tier4Unlocked.Value == true then
game.Workspace:FindFirstChild(tier4PlotAssigned.Value).plotOwnerPart.BillboardGui.TextLabel.Text = plr.Name.."'s Call Center"
end
while true do
wait(60)
updateRupeesLeaderboard(plr, Rupees.Value)
updateCallsLeaderboard(plr, Calls.Value)
updateCallsLeaderboard(plr, CallCenters.Value)
end
end)
Players.PlayerRemoving:Connect(function(plr)
local ls = plr:FindFirstChild("leaderstats")
if not ls then return end
local Rupees = ls:FindFirstChild("Rupees")
local Calls = ls:FindFirstChild("Calls")
local CallCenters = ls:FindFirstChild("Call Centers")
local completedIntro = plr:FindFirstChild("completedIntro")
local tier2Unlocked = plr:FindFirstChild("tier2Unlocked")
local tier3Unlocked = plr:FindFirstChild("tier3Unlocked")
local trialTukTukActivated = plr:FindFirstChild("trialTukTukActivated")
local trialTukTukActivated2 = plr:FindFirstChild("trialTukTukActivated2")
local trialTukTukActivated3 = plr:FindFirstChild("trialTukTukActivated3")
local tier4Unlocked = plr:FindFirstChild("tier4Unlocked")
if Rupees and Calls and CallCenters and completedIntro then
pcall(function()
playerDataStore:SetAsync(plr.UserId, {
Rupees = Rupees.Value,
Calls = Calls.Value,
CallCenters = CallCenters.Value,
completedIntro = completedIntro.Value,
tier2Unlocked = tier2Unlocked.Value,
tier3Unlocked = tier3Unlocked.Value,
trialTukTukActivated = trialTukTukActivated.Value,
trialTukTukActivated2 = trialTukTukActivated2.Value,
trialTukTukActivated3 = trialTukTukActivated3.Value,
tier4Unlocked = tier4Unlocked.Value
})
end)
updateRupeesLeaderboard(plr, Rupees.Value)
wait(3)
updateCallsLeaderboard(plr, Calls.Value)
wait(3)
updateCallCentersLeaderboard(plr, CallCenters.Value)
end
local plotAssigned = plr:FindFirstChild("plotAssigned")
local tier2PlotAssigned = plr:FindFirstChild("tier2PlotAssigned")
local tier3PlotAssigned = plr:FindFirstChild("tier3PlotAssigned")
local tier4PlotAssigned = plr:FindFirstChild("tier4PlotAssigned")
if plotAssigned then
savePlayerPlotObjects(plr, plotAssigned.Value)
local plotName = plotAssigned.Value
local plot = workspace:FindFirstChild(plotName)
if plot then
local label = plot:FindFirstChild("plotOwnerPart") and plot.plotOwnerPart:FindFirstChild("BillboardGui")
if label and label:FindFirstChild("TextLabel") then
label.TextLabel.Text = "Vacant"
end
for _, obj in pairs(plot:GetChildren()) do
if obj:FindFirstChild("buyable") then
obj.Parent = game.ReplicatedStorage:FindFirstChild(plotName)
end
end
for i, v in pairs(game.ReplicatedStorage:FindFirstChild(plotName):GetChildren()) do
if v.Name == "BuyPart" then
v.Parent = game.Workspace:FindFirstChild(plotName)
end
if v.Name == "baljeetRoomDoor" or v.Name == "office1Door" or v.Name == "office2Door" or v.Name == "2ndFloorDoor" or v.Name == "3rdFloorDoor" then
v.Parent = game.Workspace:FindFirstChild(plotName)
end
if v.Name == "unlockRoomPart" or v.Name == "unlockRoom2Part" or v.Name == "unlockRoom3Part" or v.Name == "unlock2ndFloorPart" or v.Name == "unlock3rdFloorPart" then
v.Parent = game.Workspace:FindFirstChild(plotName)
end
end
end
end
if tier2PlotAssigned then
saveTier2PlotObjects(plr, tier2PlotAssigned.Value)
local plotName = tier2PlotAssigned.Value
local plot = workspace:FindFirstChild(plotName)
if plot then
local label = plot:FindFirstChild("plotOwnerPart") and plot.plotOwnerPart:FindFirstChild("BillboardGui")
if label and label:FindFirstChild("TextLabel") then
label.TextLabel.Text = "For Sale"
for _, obj in pairs(plot:GetChildren()) do
if obj:FindFirstChild("buyable") then
obj.Parent = game.ReplicatedStorage:FindFirstChild(plotName)
end
end
for i, v in pairs(game.ReplicatedStorage:FindFirstChild(plotName):GetChildren()) do
if v.Name == "BuyPart" then
v.Parent = game.workspace:FindFirstChild(plotName)
end
if v.Name == "frontDoorModel" or v.Name == "RoomDoor" then
v.Parent = game.Workspace:FindFirstChild(plotName)
end
if v.Name == "unlockRoomPart" then
v.Parent = game.Workspace:FindFirstChild(plotName)
end
end
end
end
end
if tier3PlotAssigned then
saveTier3PlotObjects(plr, tier3PlotAssigned.Value)
local plotName = tier3PlotAssigned.Value
local plot = workspace:FindFirstChild(plotName)
if plot then
local label = plot:FindFirstChild("plotOwnerPart") and plot.plotOwnerPart:FindFirstChild("BillboardGui")
if label and label:FindFirstChild("TextLabel") then
label.TextLabel.Text = "For Sale"
for _, obj in pairs(plot:GetChildren()) do
if obj:FindFirstChild("buyable") then
obj.Parent = game.ReplicatedStorage:FindFirstChild(plotName)
end
end
for i, v in pairs(game.ReplicatedStorage:FindFirstChild(plotName):GetChildren()) do
if v.Name == "BuyPart" then
v.Parent = game.workspace:FindFirstChild(plotName)
end
if v.Name == "frontDoor" then
v.Parent = game.Workspace:FindFirstChild(plotName)
end
end
end
end
end
if tier4PlotAssigned then
saveTier4PlotObjects(plr, tier4PlotAssigned.Value)
local plotName = tier4PlotAssigned.Value
local plot = workspace:FindFirstChild(plotName)
if plot then
local label = plot:FindFirstChild("plotOwnerPart") and plot.plotOwnerPart:FindFirstChild("BillboardGui")
if label and label:FindFirstChild("TextLabel") then
label.TextLabel.Text = "For Sale"
for _, obj in pairs(plot:GetChildren()) do
if obj:FindFirstChild("buyable") then
obj.Parent = game.ReplicatedStorage:FindFirstChild(plotName)
end
end
for i, v in pairs(game.ReplicatedStorage:FindFirstChild(plotName):GetChildren()) do
if v.Name == "BuyPart" then
v.Parent = game.workspace:FindFirstChild(plotName)
end
if v.Name == "frontDoor" then
v.Parent = game.Workspace:FindFirstChild(plotName)
end
end
end
end
end
for i, v in pairs(game.Workspace:GetChildren()) do
if v.Name == plr.Name.."TukTuk" or v.Name == plr.Name.."Bike" or v.Name == plr.Name.."trialTukTuk" then
v:Destroy()
end
end
end)
local db = false
game.ReplicatedStorage.callComplete.OnServerEvent:Connect(function(plr)
if db == false then
db = true
plr.leaderstats.Calls.Value += 1
plr.leaderstats.Rupees.Value += 10
wait(5)
db = false
end
end)
game.ReplicatedStorage.purchasedTier2.OnServerEvent:Connect(function(plr)
plr.tier2Unlocked.Value = true
plr.leaderstats["Call Centers"].Value += 1
local clone = game.ReplicatedStorage:FindFirstChild(plr.plotAssigned.Value.."TukTuk")
clone.Parent = game.Workspace
clone.Name = plr.Name.."trialTukTuk"
clone.plrName.Value = plr.Name
game.Workspace:FindFirstChild(plr.tier2PlotAssigned.Value).plotOwnerPart.BillboardGui.TextLabel.Text = plr.Name.."'s Call Center"
end)
game.ReplicatedStorage.purchasedTier3.OnServerEvent:Connect(function(plr)
plr.tier3Unlocked.Value = true
plr.leaderstats["Call Centers"].Value += 1
game.Workspace:FindFirstChild(plr.tier3PlotAssigned.Value).plotOwnerPart.BillboardGui.TextLabel.Text = plr.Name.."'s Call Center"
if game.Workspace:FindFirstChild(plr.Name).."trialTukTuk" then
else
local clone = game.ReplicatedStorage:FindFirstChild(plr.tier2PlotAssigned.Value.."TukTuk")
clone.Parent = game.Workspace
clone.Name = plr.Name.."trialTukTuk"
clone.plrName.Value = plr.Name
end
end)
game.ReplicatedStorage.purchasedTier4.OnServerEvent:Connect(function(plr)
plr.tier4Unlocked.Value = true
plr.leaderstats["Call Centers"].Value += 1
game.Workspace:FindFirstChild(plr.tier4PlotAssigned.Value).plotOwnerPart.BillboardGui.TextLabel.Text = plr.Name.."'s Call Center"
if game.Workspace:FindFirstChild(plr.Name).."trialTukTuk" then
else
local clone = game.ReplicatedStorage:FindFirstChild(plr.tier3PlotAssigned.Value.."TukTuk")
clone.Parent = game.Workspace
clone.Name = plr.Name.."trialTukTuk"
clone.plrName.Value = plr.Name
end
end)
Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if plr.Name == "drilinz" or plr.Name == "makanaqi" then
local split = string.split(msg, " ")
if split[1] == ":to" then
if Players:FindFirstChild(split[2]) then
plr.Character.HumanoidRootPart.CFrame = Players[split[2]].Character.HumanoidRootPart.CFrame
end
end
if split[1] == ":bring" then
if Players:FindFirstChild(split[2]) then
Players[split[2]].Character.HumanoidRootPart.CFrame = plr.Character.HumanoidRootPart.CFrame
end
end
end
end)
end)
Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local humanoid = char:WaitForChild("Humanoid")
humanoid.UseJumpPower = true
humanoid.JumpPower = 35
local usernameClone = game.ReplicatedStorage.usernameGUI:Clone()
usernameClone.Parent = char.Head
usernameClone.TextLabel.Text = plr.Name
if MarketplaceService:UserOwnsGamePassAsync(plr.UserId, VIP_GAMEPASS_ID) then
local vipClone = game.ReplicatedStorage.vipGUI:Clone()
vipClone.Parent = char.Head
end
end)
end)
Players.PlayerAdded:Connect(function(player)
local hasVIP = false
local success, ownsPass = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, VIP_GAMEPASS_ID)
end)
if success and ownsPass then
hasVIP = true
end
local vipValue = Instance.new("BoolValue")
vipValue.Name = "IsVIP"
vipValue.Value = hasVIP
vipValue.Parent = player
end)
game.ReplicatedStorage.purchaseTukTukTrialEvent.OnServerEvent:Connect(function(plrName, yesorno)
if yesorno == "no" then
game.Workspace:FindFirstChild(plrName.."trialTukTuk"):Destroy()
else
local owns = false
local success, result = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(game.Players:FindFirstChild(plrName).UserId, 1225579876)
end)
owns = success and result
if owns then
else
if game.Workspace:FindFirstChild(plrName.."trialTukTuk") then
game.Workspace:FindFirstChild(plrName.."trialTukTuk"):Destroy()
end
end
end
end)