Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My skip stage is kinda buggy. Why is half of my body stuck in the floor?

Asked by 4 years ago

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.

0
your question is a little confusing. Do you teleport each time, but you're stuck in the floor, or are you only teleporting sometimes? ExHydraboy 30 — 4y
0
I teleport in the floor. JOZOUMRO11 34 — 4y

1 answer

Log in to vote
2
Answered by 4 years ago
Edited 4 years ago

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

0
or you could have a transparent nocollide part that you could put wherever you want the player to be moved to, then simply set the cframe to that part ExHydraboy 30 — 4y
0
^ that too ProjectInfiniti 192 — 4y
Ad

Answer this question