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

1 Line'd script, someone fix it?

Asked by
0x72 20
10 years ago

I'm trying to make a teleport/all/me script. But It wont teleport. Here is the code; so I want to make it so all of them teleport to where my torso is, but can i do this?

v.Character.Torso.Position = Vector3.new(game.Workspace.0x72) --ignore the red line on studio, my name does that.

2 answers

Log in to vote
1
Answered by 10 years ago

Given that everything is defined and you've made sure it won't break(in case you're not in the game or not every player has a torso or whatever), this line should work.

v.Character.Torso.Position = Workspace['0x72'].Torso.Position
0
Its possible to do that, but make it teleport to a part? so a=Instance.new("Part",Workspace) v.Character.Torso.Position = Workspace['Part'] 0x72 20 — 10y
Ad
Log in to vote
0
Answered by
Ekkoh 635 Moderation Voter
10 years ago

Like what Verified said, for you personally, when you index yourself you'll have to use square brackets and quotes since the first character of your username is a number, which isn't valid syntax in Lua. I think you might be under the impression that just using the variable v applies the line to everyone. I recommend reading about Loops. What you're trying to do could be accomplished by this.

for _, v in pairs(Game:GetService("Players"):GetPlayers()) do
    v.Character.Torso.CFrame = CFrame.new(Workspace["0x72"].Torso.Position)
end
-- Keep in mind that if either you or another player's character doesn't exist at the time this script executes, an error will be thrown.
0
ty for the answer, my command still doesn't work :/ 0x72 20 — 10y

Answer this question