Hello. I use techy’s difficulty chart obby system for my dco. In this system, skipping stages is not compatible with the leaderboard. I hired a scripter to fix this, he fixed it. But I got another bug. Now all functions related to moving through stages have stopped working. Here is my script. Can you help me?
the problem:
My scripts:
Main script:
local settings = require(script.Parent)
local ws = game:GetService(“Workspace”)
local sss = game:GetService(“ServerScriptService”)
local sg = game:GetService(“StarterGui”)
local rst = game:GetService(“ReplicatedStorage”)
local sp = game:GetService(“StarterPlayer”)
local event = Instance.new(“RemoteEvent”, rst)
event.Name = “ChangeStageByTechy”
local function SavingScript()
local script = Instance.new(‘Script’, game.ServerScriptService)
script.Name = “SavingScript”
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local SaveDataStore = DataStoreService:GetDataStore(settings.datastoreName)
local function SavePlayerData(player)
if settings.dataAutosaves then
local success,errormsg = pcall(function()
local SaveData = {}
for i,stats in pairs(player.leaderstats:GetChildren()) do
SaveData[stats.Name] = stats.Value
end
SaveDataStore:SetAsync(player.UserId,SaveData)
end)
if not success then
return errormsg
end
end
end
Players.PlayerAdded:Connect(function(player)
local Stats = Instance.new("Folder")
Stats.Name = "leaderstats"
Stats.Parent = player
local Stage = Instance.new("NumberValue")
Stage.Name = "Stage"
Stage.Parent = Stats
Stage.Value = 1
local Data = SaveDataStore:GetAsync(player.UserId)
if Data then
print(Data.Stage)
for i,stats in pairs(Stats:GetChildren()) do
stats.Value = Data[stats.Name]
end
elseif not settings.dataAutosaves then
print("Autosave is Disabled.")
player.leaderstats.Stage.Value = 1
end
player.CharacterAdded:Connect(function(character)
local Humanoid = character:WaitForChild("Humanoid")
local Torso = character:WaitForChild("HumanoidRootPart")
wait()
if Torso and Humanoid then
if Stage.Value ~= 0 then
local StagePart = workspace.Stages:FindFirstChild(Stage.Value)
character:MoveTo(StagePart.Position)
end
end
end)
end)
Players.PlayerRemoving:Connect(function(player)
local errormsg = SavePlayerData(player)
if errormsg then
warn(errormsg)
end
end)
game:BindToClose(function()
for i,player in pairs(Players:GetPlayers()) do
local errormsg = SavePlayerData(player)
if errormsg then
warn(errormsg)
end
end
wait(2)
end)
end
local function StageScript()
local script = Instance.new(‘Script’, game.ServerScriptService)
script.Name = “StageScript”
local Stages = workspace:WaitForChild("Stages")
for i,Stage in pairs(Stages:GetChildren()) do
Stage.Touched:Connect(function(touch)
local humanoid
if touch.Parent:FindFirstChild("Humanoid") then
humanoid = touch.Parent.Humanoid
end
if touch.Parent and touch.Parent.Parent:FindFirstChild("Humanoid") then
humanoid = touch.Parent.Parent.Humanoid
end
if humanoid then
local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
local PlayerStage = player.leaderstats.Stage.Value
if tonumber(Stage.Name) == PlayerStage + 1 then
player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1
elseif tonumber(Stage.Name) > PlayerStage + 1 then
humanoid.Health = 0
end
end
end)
end
end
local function StageTransfer()
– This script was fully made by Techyfied
– This script was open-sourced
– For Tutorial or more info, visit Techy's Obby System - All your obby needs in one! [Includes Stage Selector]
local script = Instance.new('Script', game.ServerScriptService)
script.Name = "StageTransfer"
game:GetService("ReplicatedStorage").ChangeStageByTechy.OnServerEvent:Connect(function(player, direction, target)
local char = game.Workspace:FindFirstChild(player.Name)
local function teleport()
local cp = game.Workspace.Stages:FindFirstChild(tostring(player.TeleportedStage.Value))
local cpp = cp.Position
char:MoveTo(cpp)
end
if direction == "up" then
--
player.TeleportedStage.Value = player.TeleportedStage.Value + 1
if tonumber(player.TeleportedStage.Value) > tonumber(player.leaderstats.Stage.Value) then
player.TeleportedStage.Value = 1
end
teleport()
--
elseif direction == "down" then
player.TeleportedStage.Value = player.TeleportedStage.Value - 1
if tonumber(player.TeleportedStage.Value) < 1 then
player.TeleportedStage.Value = player.leaderstats.Stage.Value
end
teleport()
elseif direction == "up2" then
player.TeleportedStage.Value = player.TeleportedStage.Value + 10
if tonumber(player.TeleportedStage.Value) > tonumber(player.leaderstats.Stage.Value) then
player.TeleportedStage.Value = 1
end
teleport()
elseif direction == "down2" then
player.TeleportedStage.Value = player.TeleportedStage.Value - 10
if tonumber(player.TeleportedStage.Value) < 1 then
player.TeleportedStage.Value = player.leaderstats.Stage.Value
end
teleport()
elseif direction == "lobby" then
player.TeleportedStage.Value = 1
teleport()
elseif direction == "lc" then
player.TeleportedStage.Value = player.leaderstats.Stage.Value
teleport()
elseif direction == "set" then
player.TeleportedStage.Value = player.leaderstats.Stage.Value
teleport()
elseif direction == "goto" then
player.TeleportedStage.Value = target
teleport()
end
if direction == "joined" then
if settings.dataAutosaves then
player.TeleportedStage.Value = player.leaderstats.Stage.Value
teleport()
print("Moved ".. player.Name.. " to their last stage." )
end
elseif direction == "respawned" then
teleport()
elseif direction == "respawned2" then
player.TeleportedStage.Value = player.leaderstats.Stage.Value
elseif direction == "Resetted" then
player.leaderstats.Stage.Value = 1
player.TeleportedStage.Value = 1
wait(0.1)
teleport()
end
end)
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local tStage = Instance.new("StringValue")
tStage.Name = "TeleportedStage"
tStage.Parent = player
wait(0.5)
tStage.Value = player.leaderstats.Stage.Value
end)
local function onCharacterAdded(character)
wait(0.1)
print("CharacterAdded")
local plr = Players:FindFirstChild(character.Name)
local tar = game.Workspace.Stages:FindFirstChild(plr.TeleportedStage.Value)
local tarp = tar.Position
if tarp then
wait(0.5)
character:MoveTo(tarp)
end
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
end
end
local TextLabel = Instance.new(“TextLabel”)
TextLabel.Parent = game.StarterGui.StageTransfer
TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TextLabel.BackgroundTransparency = 1.000
TextLabel.Position = UDim2.new(0.00635323999, 0, 0.962151408, 0)
TextLabel.Size = UDim2.new(0.902160108, 0, 0.0378486067, 0)
TextLabel.Font = Enum.Font.FredokaOne
TextLabel.Text = “”
TextLabel.TextColor3 = Color3.fromRGB(99, 110, 114)
TextLabel.RichText = true
TextLabel.TextSize = 12.000
TextLabel.TextStrokeTransparency = 0.100
TextLabel.TextXAlignment = Enum.TextXAlignment.Left
local function OnRespawn()
local script = Instance.new(“LocalScript”, sp.StarterCharacterScripts)
script.Name = “OnRespawn”
local rps = game:GetService("ReplicatedStorage")
rps.ChangeStageByTechy:FireServer("respawned")
end
local MarketplaceService = game:GetService(“MarketplaceService”)
local productId = settings.skipStageProductID
MarketplaceService.ProcessReceipt = function(receiptInfo)
local players = game.Players:GetPlayers()
local done = 0
for i=1,#players do
if players[i].userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == productId and done == 0 then
done = 1
players[i].leaderstats.Stage.Value = players[i].leaderstats.Stage.Value + 1
--players[i].TeleportedStage.Value = players[i].leaderstats.Stage.Value
players[i].Character:MoveTo(game.Workspace.Stages:FindFirstChild(players[i].leaderstats.Stage.Value).Position)
done = 0
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
if settings.skipStageProductID == 0 then
game.StarterGui:FindFirstChild(“StageTransfer”).SkipStage:Destroy()
end
coroutine.wrap(SavingScript)()
coroutine.wrap(StageScript)()
coroutine.wrap(StageTransfer)()
coroutine.wrap(OnRespawn)()
If you can help me, I will be very grateful to you