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

Did teleporting break in the new update or am I going crazy?

Asked by
Azmidium 388 Moderation Voter
9 years ago

I have this loop here that teleports players in this game I have called Binary Bash. I have been using this SAME LOOP for the whole game, and it was working fine. After I updated my studio TODAY, the whole thing breaks....

This is the teleport loop: - I tested this with a player, that has watch set to false

    for _, player in pairs (PlayersInGame) do
        if game.Workspace:FindFirstChild(player.Name) then
            if not player.Settings.Watch.Value then
                player:WaitForChild("Character"):MoveTo(map.SpawnPlat.Position)
            end
        end
    end

Can someone explain why this won't work, or did Roblox decide to remove :MoveTo()??

1
I am not getting any errors, BTW. Azmidium 388 — 9y
1
Use CFrame Hero_ic 502 — 9y
0
I will try it, but I doubt that would change the outcome since MoveTo is a Roblox function. Azmidium 388 — 9y
0
And OFC it works, it always works when I think I am right... Azmidium 388 — 9y

1 answer

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

The main problem with this code is :WaitForChild("Character").

The Character is not a child of the player (it's parent is the workspace, afterall) -- it is a property. Thus :WaitForChild will just keep waiting forever.

In a related note, don't look in the workspace for something with the same name. Just look at the player.Character property.


for _, player in pairs( PlayersInGame ) do
    if player.Character then
        if not player.Settings.Watch.Value then
            player.Character:MoveTo( map.SpawnPlat.Position )
        end
    end
end
Ad

Answer this question