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

Why doesn't it teleport all players??

Asked by 6 years ago

so I was trying to make a script where it changes peoples clothes, teleports them and enables a local script, for some reason when I do it, it only does it to one player and not both.

I don't know what I am doing wrong. (Note: this is in a non-fe game since this is going to be a non-public game, only me and my friends that I know locally will play.)

    local group = {
    [""] = true;
    ["Mr_Static"] = true;
}

game.Players.PlayerAdded:connect(function(player)
    if group[player.Name] then 
        player.Chatted:connect(function(msg)
            if msg == "@Start" then
                for i,v in pairs(game.Players:GetChildren()) do
                    if v.Name ~= "Mr_Staticz" then
                        v.Character.Humanoid.WalkSpeed = 0
                        v.Character.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=105739216"
                        v.Character.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=105798612"
                        if v.Name == "Mr_Static" then
                            v.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(-370.96, 2192, 55.664))
                        end
                        if v.Name == "luka_1630" then
                            v.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(-304.157, 2192.655, 27.778))
                        end
                    end
                    v.PlayerGui.CutsceneScript.Disabled = false
                    game.Workspace.HGForest.Theme:Play()
                    wait(32)
                    game.Workspace.HGForest.Theme:Stop()
                end
            end
        end)
    end
end)

What it's supposed to do is when Mr_Static chats @Start it makes every player other than Mr_Staticz walkspeed 0 and change their clothing. Then if the players name == Mr_Static it would teleport him to -370.96, 2192, 55.664 and if the players == luka_1630 then it would teleport them to -304.157, 2192.655, 27.778 and enable the localscript aswell as play the audio.

Basically what happens is when Mr_Static says @Start does everything what it's supposed to but only for Mr_Static, and not for luka_1630 which is supposed to have the same thing happen as Mr_Static just different teleport location.

If someone could help me with this and tell me what I am doing wrong, that would be great thanks.

0
still looking for help. iiDayzie_Dreams 32 — 6y

Answer this question