#(very new at scripting to lua) Need help for my script
43 messages · Page 1 of 1 (latest)
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local LOBBY_PLACE_ID = 123456789
local DEATH_MAX = 3
local deathCounters = {}
local function onCharacterAdded(character: Model, player: Player)
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid then
player:Kick("Could not find Humanoid.")
return
end
humanoid.Died:Once(function()
deathCounters[player] += 1
if deathCounters[player] < DEATH_MAX then
return
end
-- Player has reached maximum death allowance.
local success, response = pcall(TeleportService.TeleportAsync, TeleportService, LOBBY_PLACE_ID, {player})
if success then
return
end
-- Teleport failed.
player:Kick("Teleport failed.")
error(response)
end)
end
local function onPlayerAdded(player: Player)
deathCounters[player] = 0
local character = player.Character
if character then
onCharacterAdded(character, player)
end
player.CharacterAdded:Connect(function(character)
onCharacterAdded(character, player)
end)
end
local function onPlayerRemoving(player: Player)
deathCounters[player] = nil
end
for _, player in Players:GetPlayers() do
onPlayerAdded(player)
end
Players.PlayerAdded:Connect(onPlayerAdded)
Players.PlayerRemoving:Connect(onPlayerRemoving)
hm
** You are now Level 2! **
Type of script and where?
Keep in mind that TeleportService does not work in Roblox Studio
join this and try to reset 3 times
^
no errors, just not tping me for some reason
Send photo of the script you inserted into the Explorer
me try now
YES
ITS WORKS
ITS WORKS
IT WORKS
YESSSSSSSSSSSSSSSSSSSSSSSSSSSS
ASKJDRHTSEIU4TY4E8T9PH4896NIUOKHNFTS
THANK YOU BROOO
yo
i need a lil help again
I want to make it so taht once a player dies 3 times, it adds to the loss
