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

Vector3.new() Teleport i=1,2,2???? {SOLVED}

Asked by 10 years ago

I have a non-local script that is making my Slender Minigames game run... so anyways... I have

player=game:GetService("Players"):GetPlayers()

I have it where it SHOULD teleport "player" to the maps on "player" SlenderMan Spawn and on to Surviver Spawn

and for some reason it wont use Vector3.new() to teleport to the Spawn it will teleport A "player" but only 1 and I need two players for the game to start. Nother Question : Isnt it

 i = 1 do 1,2,2 then

Because Im having my questions on how good this is working.

NeedSomeHelpPLEASE

along with Vector3.new() NOT working correctly the way I want, There is a NOTHER PROBLEM!

I need it to spawn "SlenderMan" aka "player" spawn looking like SlenderMan.

I dont want a "Char" thats SIMPLE.

Heres what I have so far...

local player = game:GetService("Players"):GetPlayers()
print("Got Players")
for i = 1, #player do 
print("Have Players")
game.Lighting.Minigame1:clone().Parent = game.Workspace
wait(15)
print("Teleporting Players To Map")
player[i].Character:MoveTo(Vector3.new(2742.16, 919.19, -433.668))
script.Parent.L1:Pause()
script.Parent.M1:Play()
script.Parent.L1.SoundId = "rbxassetid://144652376"
wait(60)

1 answer

Log in to vote
0
Answered by 10 years ago

You have several problems here. First of all, you are cloning the map as many times as there are players. If there are 3 players, you're cloning the map 3 times. Move line 5 above the for loop.

Secondly, you are using :MoveTo() on Characters. You need to use MoveTo on their Torsos.

Lastly, you are missing your end. You always need to end statements that need ends.

Also, you should really indent properly, it makes the code much easier to read. And the final thing, I'm not even sure if MoveTo works on players. It is better to CFrame their Torsos, as I am sure that works.

Here is the corrected code:

local player = game:GetService("Players"):GetPlayers()
print("Got Players")
game.Lighting.Minigame1:clone().Parent = game.Workspace
    for i ,v in pairs(player) do --I prefer this to "i = 1".
        print("Have Players")

        wait(15)

        print("Teleporting Players To Map")
        player[i].Character.Torso:MoveTo(Vector3.new(2742.16, 919.19, -433.668)) --moving the Torso, rather than character
        script.Parent.L1:Pause()
        script.Parent.M1:Play()
        script.Parent.L1.SoundId = "rbxassetid://144652376"
        wait(60)
    end

Hope I helped!

0
OMG THANK YOU!!!!! I WAS SO STUMPED! jillmiles1 3 — 10y
0
No problem! SlickPwner 534 — 10y
Ad

Answer this question