Hey Developers!
I am currently making a story game, and when I was making the DeathGui, I came across two problems!
Problem 1: For some reason, the timer instantely skips to 1! The whole point is, is that the player is supposed to have 10 seconds to buy the respawn products, if they don’t they get teleported back to the lobby. If they do, the timer stops. The timer should only start once the player dies. And for some reason, the products don’t prompt a purchase. For the prompt purchase, I get no errors, nor with the timer, apart from the Cannot Teleport In Roblox Studios
My Layout:
My Timer script:
local Player = game.Players.LocalPlayer
local TeleportService = game:GetService('TeleportService')
for i = 10, 1, -1 do
script.Parent.Text = i
if i == 1 then
TeleportService:Teleport(4829096567, Player)
end
end
My Prompt Purchase script
MPS = game:GetService('MarketplaceService')
Player = game:GetService('Players').LocalPlayer
Spawn1Id = 967744749
Spawn2Id = 967744795
Spawn3Id = 967744812
Spawn4Id = 967744826
Spawn5Id = 967745107
DeathAmount = Player:WaitForChild('Deaths').Value
script.Parent.MouseButton1Click:Connect(function()
if DeathAmount == 1 then
MPS:PromptProductPurchase(Player, Spawn1Id)
elseif DeathAmount == 2 then
MPS:PromptProductPurchase(Player, Spawn2Id)
elseif DeathAmount == 3 then
MPS:PromptProductPurchase(Player, Spawn3Id)
elseif DeathAmount == 4 then
MPS:PromptProductPurchase(Player, Spawn4Id)
elseif DeathAmount >= 5 then
MPS:PromptProductPurchase(Player, Spawn5Id)
end
end)
And my show death screen script:
local Player = game.Players.LocalPlayer
Player.Character:WaitForChild('Humanoid').Died:Connect(function()
wait(1)
script.Parent.Frame.Visible = true
script.Parent.Frame.Position = UDim2.new(0,0,-1,0)
script.Parent.Frame:TweenPosition(UDim2.new(0,0,0,0), Enum.EasingDirection.In, Enum.EasingStyle.Quad, 1)
end)
Any help is appreciated!