Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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.

2 comments

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?

0

I teleport in the floor.

1 answer

✓ Accepted answer

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

2 comments

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

0

^ that too

This discussion is preserved as it was. New answers, comments, and votes are closed.