cena do tiago
unknown
lua
3 years ago
2.7 kB
8
Indexable
local checkpointsFolder = workspace.Checkpoints
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UpdateProgressEvent = ReplicatedStorage:WaitForChild("UpdateProgressEvent")
local stages = checkpointsFolder:GetChildren()
local stagecount = #stages
local MarketplaceService = game:GetService("MarketplaceService")
local skipid = 1369076108
local BadgeService = game:GetService("BadgeService")
local badgeWelcome = 2139687019
switch = function(param, case_table)
local case = case_table[param]
if case then return case() end
local def = case_table['default']
return def and def() or nil
end
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local stage = Instance.new("IntValue")
stage.Name = "Stage"
stage.Value = 1
stage.Parent = leaderstats
local deaths = Instance.new("IntValue")
deaths.Name = "Deaths"
deaths.Value = 0
deaths.Parent = player
player.CharacterAdded:Connect(function(character)
local hum = character:WaitForChild("Humanoid")
wait()
hum.Died:Connect(function(char)
if deaths.Value+1 == 3 then
MarketplaceService:PromptProductPurchase(player, skipid)
deaths.Value = 0
else
deaths.Value += 1
end
end)
character:MoveTo(checkpointsFolder[stage.Value].Position)
hum.Touched:Connect(function(hit)
if hit.Parent == checkpointsFolder then
if tonumber(hit.Name) == stage.Value +1 then
deaths.Value = 0
stage.Value += 1
UpdateProgressEvent:FireClient(player, false)
switch(stage.Value, {
[11] = function()
if BadgeService:GetBadgeInfoAsync(2139686813).IsEnabled then
BadgeService:AwardBadge(player.UserId, 2139686813)
print("badge ")
end
end,
[26] = function()
if BadgeService:GetBadgeInfoAsync(2140323424).IsEnabled then
BadgeService:AwardBadge(player.UserId, 2140323424)
print("badge ")
end
end,
[31] = function()
if BadgeService:GetBadgeInfoAsync(2140323759).IsEnabled then
BadgeService:AwardBadge(player.UserId, 2140323759)
print("badge ")
end
end,
[41] = function()
if BadgeService:GetBadgeInfoAsync(2140324060).IsEnabled then
BadgeService:AwardBadge(player.UserId, 2140324060)
print("badge ")
end
end,
[50] = function()
if BadgeService:GetBadgeInfoAsync(2140324393).IsEnabled then
BadgeService:AwardBadge(player.UserId, 2140324393)
print("badge ")
end
end,
})
end
end
end)
end)
end)
Editor is loading...