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

What is wrong with this script?

Asked by 9 years ago

I tested my game, and it doesn't seem to be working... Also, the target2 and target3 variables won't be used until late in the script.

StarterGui.ScreenGui.Map1.Visible = Map1
player = game.Players:GetChildren() 
target1 = Vector3.new(-7, 9.8, -4)
target2 = Vector3.new(56, 25.8, 0.5)
target3 = Vector3.new(-1.5, 8.7, 61.5)




repeat
wait(5)
for i,plr in pairs(game.Players:GetChildren()) do

    plr.TeamColor = game.Teams["In the Blitz"].TeamColor

end
function fadeTo(a, b, c)
    for transparency = a, b, c do
    --go from a to b, counting by c

        for _, part in pairs(player.Character:GetChildren()) do
        --for each of the objects in the character,

            if part:IsA("BasePart") then
            --check if it's a part, and if so

                part.Transparency = transparency
                --set its transparency
            end
        end
        wait(0.1)
    end
end

fadeTo(0, 1, 0.1) --fade out,
player.Character.Torso.CFrame = target1 --teleport the player
fadeTo(1, 0, -0.1) --fade back in
wait(10)



until 2+6==4 

1 answer

Log in to vote
0
Answered by
Azarth 3141 Moderation Voter Community Moderator
9 years ago

player.Character.Torso.CFrame = target1 --teleport the player

All your target variables are Vectors, not CFrame's.

player.Character:MoveTo(target1)

Also, you have to loop through players to spawn each one, you can't do what you did.

for i,v in pairs(game.Players:GetPlayers()) do 
    v.Character:MoveTo(target1)
end
Ad

Answer this question