I am making an obby and i have made my skip stage gui. It is working but each time i am testing it it teleports me to the next stage but half of my body is stuck to the floor. Sometimes i teleport properly but it is rare to happen.
This is my script:
local service = game:GetService("MarketplaceService") local dev_product_id = 980377204 local stage_folder = workspace:WaitForChild("Stages") wait(1) if workspace:FindFirstChild("Stages") then service.ProcessReceipt = function(receiptInfo) if receiptInfo.ProductId == dev_product_id then local plr = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId) if plr then local leaderboard = plr:FindFirstChild("leaderstats") if leaderboard then local stage = leaderboard:FindFirstChild("Stage") if stage then if stage_folder:FindFirstChild("Stage" .. stage.Value+1) then wait() plr.Character.HumanoidRootPart.CFrame = CFrame.new(stage_folder:FindFirstChild("Stage" .. stage.Value+1).Position) return Enum.ProductPurchaseDecision.PurchaseGranted else return Enum.ProductPurchaseDecision.NotProcessedYet end else return Enum.ProductPurchaseDecision.NotProcessedYet end else return Enum.ProductPurchaseDecision.NotProcessedYet end else return Enum.ProductPurchaseDecision.NotProcessedYet end end end else print("Not found Stages In the Stages folder.") end
This script is located in ServerScriptService.
that is because when you teleport, you move the humanoid root part however, the body is stuck in the floor because the position is in the middle of the root part, so when you teleport, the middle of the root part, or the center of the body, goes to the platform, causing the body to be stuck
instead, offset the teleport end location so you teleport above the pad.
local service = game:GetService("MarketplaceService") local dev_product_id = 980377204 local stage_folder = workspace:WaitForChild("Stages") wait(1) if workspace:FindFirstChild("Stages") then service.ProcessReceipt = function(receiptInfo) if receiptInfo.ProductId == dev_product_id then local plr = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId) if plr then local leaderboard = plr:FindFirstChild("leaderstats") if leaderboard then local stage = leaderboard:FindFirstChild("Stage") if stage then if stage_folder:FindFirstChild("Stage" .. stage.Value+1) then wait() plr.Character.HumanoidRootPart.CFrame = CFrame.new(stage_folder:FindFirstChild("Stage" .. stage.Value+1).Position + Vector3.new(0,10,0)) return Enum.ProductPurchaseDecision.PurchaseGranted else return Enum.ProductPurchaseDecision.NotProcessedYet end else return Enum.ProductPurchaseDecision.NotProcessedYet end else return Enum.ProductPurchaseDecision.NotProcessedYet end else return Enum.ProductPurchaseDecision.NotProcessedYet end end end else print("Not found Stages In the Stages folder.") end