Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Players won't teleport from lobby to the map?

Asked by 5 years ago

Hello, I’m wondering if anyone can help me…

I have been trying to make a game using the Mad Bloxxer kit. At first everyone spawns to the map however after saving and returning to edit the game they won’t spawn and stay at the lobby. This is the warning (First Line)…. 14:57:45.894 - Infinite yield possible on 'Workspace.Player1:WaitForChild("Torso")' 14:57:45.895 - Stack Begin 14:57:45.896 - Script 'ServerScriptService.MainScript', Line 333 14:57:45.897 - Stack End

Here is the script showing line 333 where it could possibly be the issue?

--teleport contestants
local spawnsmodel = newmap:WaitForChild("Spawns")
local spawns = spawnsmodel:GetChildren()
for i, player in ipairs(contestants) do
    if player and player.Character and #spawns > 0 then
        local torso = player.Character:WaitForChild("Torso")
        local humanoid = player.Character:WaitForChild("Humanoid")
        local spawnindex = math.random(1, #spawns)
        local spawn = spawns[spawnindex]
        if spawn and torso and humanoid then
            humanoid.Health = 100
            humanoid.WalkSpeed = 16
            table.remove(spawns, spawnindex)
            torso.CFrame = CFrame.new(spawn.Position + Vector3.new(0, 3, 0))

            local matchtag = Instance.new("StringValue")
            matchtag.Name = "MatchTag"
            matchtag.Parent = player.Character

            local backpack = player:FindFirstChild("Backpack")
            if backpack then
                if player == bloxxer then
                    local sword = serverstorage:WaitForChild("Sword"):clone()
                    sword.Parent = backpack
                    event:FireClient(player, "Class", "Bloxxer")

                    local mydata = playerdata[player.userId]
                    if mydata and mydata.emeraldsword == 1 then
                        local emeraldswordvalue = sword:FindFirstChild("EmeraldSword")
                        if emeraldswordvalue then
                            emeraldswordvalue.Value = true
                        end
                    end

                elseif player == sheriff then
                    local netgun = serverstorage:WaitForChild("Net Gun"):clone()
                    netgun.Parent = backpack
                    event:FireClient(player, "Class", "Sheriff")
                else
                    event:FireClient(player, "Class", "Bystander")
                end
            end
        end
    end
end
spawnsmodel:remove()
0
Please don't steal scripts. I'm not helping BlackOrange3343 2676 — 5y
0
Steal? he openly gave this out MrIncredible82 -10 — 5y
0
I have been following his tutorials the last month or so,I don't steal anything MrIncredible82 -10 — 5y
0
Included code should be your own code. Ask the original writer of this script for help. xPolarium 1388 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Hello MrIncredible82

Your problem is that you either have to change your character type to R6 or you have to change every line that is trying to find the bodypart "Torso" to try to find the bodypart "HumanoidRootPart".

Your script does not work because Roblox changed these things when R15 came out and split the Torso into two parts: "LowerTorso" and "UpperTorso". You can see every bodypart in the r15 avatar here.

0
I cannot thank you enough! I really appreciate your help. MrIncredible82 -10 — 5y
0
Thank you so much MrIncredible82 -10 — 5y
0
No problem man :) frederikhome 44 — 5y
Ad

Answer this question