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

Stage Skip serverscripts not working, how can I fix?

Asked by
Shayph 5
1 year ago

So currently, I am working on a guess the characters game and I want to make a Skip stage option. This option will teleport the player to the next stage via a transparent teleport pad placed in the next room and will display a GUI on the screen of the player that had bought the skip for a short few second showing what character it was. Currently I have a problem where after buying the developer product "skip", it teleports to only one teleport part and displays the wrong GUI.

This is inside a ServerScript inside the the skip block

local skipID = 1349728281

script.Parent.SkipPrompt.Triggered:Connect(function(player)
    game:GetService("MarketplaceService"):PromptProductPurchase(player, skipID)
end)

This is inside a ServerScript inside the skip block

local marketPlaceService = game:GetService("MarketplaceService")

marketPlaceService.ProcessReceipt = function(receiptInfo)
    local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
    local Character = player.Character or player.CharacterAdded:Wait()

    if receiptInfo.ProductId == 1349728281 then
        Character:WaitForChild("HumanoidRootPart").CFrame = game.Workspace:WaitForChild("SkipTeles"):WaitForChild("MarioSkips"):WaitForChild("MarioSkip").CFrame
    end

    wait(1)

    player.PlayerGui.AnswerGUI.Frame.TextLabel.Text = "The Answer Was Mario!"
    player.PlayerGui.AnswerGUI.Frame.TextLabel.BackgroundColor3 = Color3.fromRGB(255, 14, 6)
    player.PlayerGui.AnswerGUI.Frame.Visible = true

    wait(3)
    player.PlayerGui.AnswerGUI.Frame.Visible = false

    return Enum.ProductPurchaseDecision.PurchaseGranted 
end

My most recent door is a Luigi door, and the GUI only shows up with "The Answer was Luigi!" But, when I try to skip the luigi door it only teleports to the mario skip teleport pad.

Answer this question