SKIP Button Not working properly

I am having issues with this button in 2 ways

  1. whenever i add a prompt system to turn it into a gamepass, the script completely breaks and stops working

  2. it changes my stage but does not teleport me to stage skipped to.

I am trying to complete this action also by way of a remote event.

I could really use some help. i want to know what I’m doing wrong.

Here is my code:

1 Like

Maybe use a player:LoadCharacter()

1 Like

Where do you suggest i use this string?

1 Like

After player.Team, also wait like a second. task.wait(1)

1 Like

Is there code for the teleport at all?

1 Like

You could try to use :WaitForChild(stage.Name +1) , as I think you’re currently trying to add to an instance. You could also use :LoadCharacter() to respawn them. For the prompt error, could you elaborate more, as currently there isn’t much information except that it breaks. Also, for a skip stage it should be a developer product, not a gamepass.

local remote = game:GetService("ReplicatedStorage")
local remote1 = remote:WaitForChild("SkipStage")
local teams = game:GetService("Teams") -- I removed the :GetChildren() so I could use WaitForChild later.

remote1.OnServerEvent:Connect(function(player)
local stage = table.find(teams:GetChildren(), player.Team)
player.Team = teams:WaitForChild(tostring(tonumber(player.Team.Name) + 1)) -- .Name and tostring need to be used because otherwise you'll be attempting to perform a calculation on an instance.
player:LoadCharacter() -- Respawns the player so they teleport to the next stage.

end)
1 Like

what errors appeared in the output if any??

1 Like

You’re adding a string to a number, which will error.

player.Team = teams:WaitForChild(tostring(tonumber(player.Team.Name) + 1))
1 Like

All of you Guys were right. Thank you so much for your help. it seems as though I was just missing a function to actually teleport the player, it was not there at all.

And as far as the gamepass not working, a player did remind me that skips are not by way of gamepasses which i completely did forget. Thank you everyone for all of your input. I’ve learned to use a new function today.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.