#This script is randomly killing players

33 messages · Page 1 of 1 (latest)

spark drum
#

everytime its set to tp to the spawn parts, i just die?
heres the script

local maps = game:GetService("ServerStorage").Maps:GetChildren()
local Title = game.StarterGui.MapSelector.Title
local spawns = game.Workspace.Spawns:GetChildren()
local status = game.ReplicatedStorage.Status
ti = 0

while true do
ti = 10
repeat
ti = ti -1
status.Value = "Intermission "..ti
wait(1)
until ti == 0

local randomMap = maps[math.random(1, #maps)]
randomMap:Clone().Parent = workspace
current = randomMap.Name

status.Value = "Chosen game is "..randomMap.Name
wait(5)
status.Value = "Loading game!"
wait(2)
status.Value = "Starting game!"
wait(2)
local plrs = game.Players:GetChildren()

for i = 1, #plrs do
    local randomSpawn = spawns[math.random(1, #spawns)]
    plrs[i].Character.HumanoidRootPart.CFrame = CFrame.new(randomSpawn.Position)
end

ti = 30
repeat
    ti = ti -1
    status.Value = ti.." seconds left!"
    wait(1)
until ti == 0
for i = 1, #plrs do
    plrs[i].Character.HumanoidRootPart.CFrame = workspace.SpawnLocation.CFrame + Vector3.new(0, 10, 0)
end

workspace[current]:Destroy()

end

maiden gulch
#

playergui not startergui salute

woeful bane
#

you're probably ripping the hrp out of the player character which kills them

maiden gulch
#

more likely one of the spawns is invalid or at the death plane

glossy wyvern
# spark drum everytime its set to tp to the spawn parts, i just die? heres the script local ...
local maps = game:GetService("ServerStorage").Maps:GetChildren()
local Title = game.StarterGui.MapSelector.Title
local spawns = game.Workspace.Spawns:GetChildren()
local status = game.ReplicatedStorage.Status
ti = 0

while true do
    ti = 10
    repeat
        ti = ti - 1
        status.Value = "Intermission " .. ti
        wait(1)
    until ti == 0

    local randomMap = maps[math.random(1, #maps)]
    local clonedMap = randomMap:Clone()
    clonedMap.Parent = workspace
    current = clonedMap.Name

    status.Value = "Chosen game is " .. clonedMap.Name
    wait(5)
    status.Value = "Loading game!"
    wait(2)
    status.Value = "Starting game!"
    wait(2)

    local plrs = game.Players:GetChildren()

    for i = 1, #plrs do
        if plrs[i].Character and plrs[i].Character:FindFirstChild("HumanoidRootPart") then
            local randomSpawn = spawns[math.random(1, #spawns)]
            plrs[i].Character:MoveTo(randomSpawn.Position + Vector3.new(0, 5, 0))
        end
    end

    ti = 30
    repeat
        ti = ti - 1
        status.Value = ti .. " seconds left!"
        wait(1)
    until ti == 0

    for i = 1, #plrs do
        if plrs[i].Character and plrs[i].Character:FindFirstChild("HumanoidRootPart") then
            plrs[i].Character:MoveTo(workspace.SpawnLocation.Position + Vector3.new(0, 10, 0))
        end
    end

    workspace[current]:Destroy()
end```
@spark drum try?
what it fixed:
players won't teleport into the ground ![skull](https://cdn.discordapp.com/emojis/1334559201233604658.webp?size=128 "skull")
characters will probably be checked before tping ![rizz](https://cdn.discordapp.com/emojis/1184475624199438439.webp?size=128 "rizz")
maps are properly cloned and deleted at the end so uh should work now
spark drum
#

OHHH TYTYTYTYT

spark drum
#

am i doing something wrong?

glossy wyvern
# spark drum so it works but it still die for some reason and it tps me back tot he lobby
local maps = game:GetService("ServerStorage").Maps:GetChildren()
local Title = game.StarterGui.MapSelector.Title
local spawns = game.Workspace.Spawns:GetChildren()
local status = game.ReplicatedStorage.Status
ti = 0

while true do
    ti = 10
    repeat
        ti = ti - 1
        status.Value = "Intermission " .. ti
        wait(1)
    until ti == 0

    local randomMap = maps[math.random(1, #maps)]:Clone()
    randomMap.Parent = workspace
    current = randomMap

    status.Value = "Chosen game is " .. randomMap.Name
    wait(5)
    status.Value = "Loading game!"
    wait(2)
    status.Value = "Starting game!"
    wait(2)

    local plrs = game.Players:GetPlayers()

    for i = 1, #plrs do
        if plrs[i].Character and plrs[i].Character:FindFirstChild("HumanoidRootPart") then
            local randomSpawn = spawns[math.random(1, #spawns)]
            plrs[i].Character:MoveTo(randomSpawn.Position + Vector3.new(0, 5, 0))
            plrs[i].Character:FindFirstChildOfClass("Humanoid").Health = plrs[i].Character:FindFirstChildOfClass("Humanoid").MaxHealth
        end
    end

    ti = 30
    repeat
        ti = ti - 1
        status.Value = ti .. " seconds left!"
        wait(1)
    until ti == 0

    for i = 1, #plrs do
        if plrs[i].Character and plrs[i].Character:FindFirstChild("HumanoidRootPart") then
            plrs[i].Character:MoveTo(workspace.SpawnLocation.Position + Vector3.new(0, 10, 0))
            plrs[i].Character:FindFirstChildOfClass("Humanoid").Health = plrs[i].Character:FindFirstChildOfClass("Humanoid").MaxHealth
        end
    end

    current:Destroy()
end```
#

@spark drum used GetPlayer() instead of GetChildren() for better player handling. and i changed few things, pretty sure it'll work now

#

if not let me know

spark drum
#

ok tysm

spark drum
#

sorry for taking alot of ur time 😭

#

im sending a video

#

to show u

#

what happening

#

ignore the backgroun noises

#

WAIT

#

it doesnt show for somereason

#

ill record another one

#

oh shoot

#

i just realised

#

it actually takes me there

#

but the maps dont appear

#

so i just fall into the void

#

ignore the backrgound sounds

glossy wyvern
#

@spark drum

local maps = game:GetService("ServerStorage").Maps:GetChildren()
local Title = game.StarterGui.MapSelector.Title
local spawns = game.Workspace.Spawns:GetChildren()
local status = game.ReplicatedStorage.Status
ti = 0

while true do
    ti = 10
    repeat
        ti = ti - 1
        status.Value = "Intermission " .. ti
        wait(1)
    until ti == 0

    local randomMap = maps[math.random(1, #maps)]:Clone()
    randomMap.Parent = workspace
    repeat wait() until randomMap:IsDescendantOf(workspace) 

    status.Value = "Chosen game is " .. randomMap.Name
    wait(5)
    status.Value = "Loading game!"
    wait(2)
    status.Value = "Starting game!"
    wait(2)

    local plrs = game.Players:GetPlayers()

    for i = 1, #plrs do
        if plrs[i].Character and plrs[i].Character:FindFirstChild("HumanoidRootPart") then
            local randomSpawn = spawns[math.random(1, #spawns)]
            plrs[i].Character:MoveTo(randomSpawn.Position + Vector3.new(0, 5, 0))
            plrs[i].Character:FindFirstChildOfClass("Humanoid").Health = plrs[i].Character:FindFirstChildOfClass("Humanoid").MaxHealth
        end
    end

    ti = 30
    repeat
        ti = ti - 1
        status.Value = ti .. " seconds left!"
        wait(1)
    until ti == 0

    for i = 1, #plrs do
        if plrs[i].Character and plrs[i].Character:FindFirstChild("HumanoidRootPart") then
            plrs[i].Character:MoveTo(workspace.SpawnLocation.Position + Vector3.new(0, 10, 0))
            plrs[i].Character:FindFirstChildOfClass("Humanoid").Health = plrs[i].Character:FindFirstChildOfClass("Humanoid").MaxHealth
        end
    end

    randomMap:Destroy()
end```
#

this will ensure that

#

the maps are loaded beofre players get teleported

#

try it

spark drum
#

TYSMSMSMSMSM]