i have a skip stage button code in starter gui and I’m trying to use topbarplus to do it, what I tried:
local Icon = require(game:GetService("ReplicatedStorage").Icon)
local icon = Icon.new()
:setLabel("Skip")
:setTip("Click to Buy Skip!")
icon.MouseButton1Click:Connect(function()
local Checkpoints = workspace:WaitForChild("Checkpoints")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local StageLeaderstat = player:WaitForChild("leaderstats"):WaitForChild("Level")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SkipStage = ReplicatedStorage:WaitForChild("SkipStage")
if #Checkpoints:GetChildren() ~= StageLeaderstat.Value then
local Response = SkipStage:InvokeServer()
end
end)
local player = game:GetService("Players").LocalPlayer
local playerGui = player.PlayerGui
the gui script
local TextButton = script.Parent
local Checkpoints = workspace:WaitForChild("Checkpoints")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local StageLeaderstat = player:WaitForChild("leaderstats"):WaitForChild( "Level")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SkipStage = ReplicatedStorage:WaitForChild("SkipStage")
TextButton.MouseButton1Click:Connect(function()
if TextButton.Text == "Skip Level" then
if #Checkpoints:GetChildren() ~= StageLeaderstat.Value then
TextButton.Text = "Buying..."
local Response = SkipStage:InvokeServer()
TextButton.Text = Response
else
TextButton.Text = "your are at the last stage lol"
end
wait(2)
TextButton.Text = "Skip Level"
end
end)