of     1   

KittyMcNewt
#44621969Saturday, March 26, 2011 4:56 PM GMT

function onButtonClicked() p = script.Parent.Parent.Parent.Parent.Playername.Character t = p:findFirstChild("Torso") t.Position = Position+Vector3.new(0, 40, 0) end script.Parent.MouseButton1Click:connect(onButtonClicked) Output says "Playername is not a valid member of Player." So, what would I put there?
Greendolph
#44622419Saturday, March 26, 2011 5:02 PM GMT

You would put the name of the player there... If the gui an ancestor of the Player instance you dont even need the players name, you can do something like player = script.Parent while player.className ~= "Player" do player = player.Parent end and hten player will equal the player.
KittyMcNewt
#44622565Saturday, March 26, 2011 5:04 PM GMT

Would that work for everybody in a server or just for the person named "Player?"
shouksta
#44622740Saturday, March 26, 2011 5:07 PM GMT

Use this in a LocalScript function onButtonClicked() p = game.Players.LocalPlayer.Character t = p:findFirstChild("Torso") t.Position = Position+Vector3.new(0, 40, 0) end script.Parent.MouseButton1Click:connect(onButtonClicked)
Greendolph
#44622954Saturday, March 26, 2011 5:11 PM GMT

@Newt That would work for the player that clicks the GUI button. (The local player) If you want this to happen for every player in teh server you need to use a table of the player service and a for loop. e.g. P = game.Players:GetChildren() for i=1, #p do p[i].Character.Torso.CFrame = CFrame.new(x, y, z) end
KittyMcNewt
#44623200Saturday, March 26, 2011 5:15 PM GMT

@shouksta Output says for line 4 "Bad Argument for "?" (Vector3 expected, got nil)"
Greendolph
#44623267Saturday, March 26, 2011 5:16 PM GMT

Mm. Position isnt defined. (Which is what nil means, "Doesnt exist") Position of what?
KittyMcNewt
#44623355Saturday, March 26, 2011 5:17 PM GMT

Position of the user's torso.
shouksta
#44623374Saturday, March 26, 2011 5:17 PM GMT

sorry i shouldn't expect position to be defined >.> use this function onButtonClicked() p = game.Players.LocalPlayer.Character t = p:findFirstChild("Torso") t.Position = t.Position+Vector3.new(0, 40, 0) end script.Parent.MouseButton1Click:connect(onButtonClicked)
KittyMcNewt
#44623481Saturday, March 26, 2011 5:19 PM GMT

Oh yeah, I totally forgot about that too.
KittyMcNewt
#44623547Saturday, March 26, 2011 5:20 PM GMT

Wow... I feel stupid. How would I teleport a whole body? Right now it just teleports the torso and kills me.
shouksta
#44623623Saturday, March 26, 2011 5:21 PM GMT

Sorry i'm the one being stupid didn't realise you were moving the torso function onButtonClicked() p = game.Players.LocalPlayer.Character t = p:findFirstChild("Torso") t.CFrame = t.CFrame+Vector3.new(0, 40, 0) end script.Parent.MouseButton1Click:connect(onButtonClicked)
KittyMcNewt
#44624378Saturday, March 26, 2011 5:32 PM GMT

Yeah! I finally got my elevator working! To building helpers now! JK.

    of     1