smunkeyJoin Date: 2011-12-17 Post Count: 342 |
I have made this teleportation gui script, however it won't work. In the script it shows no errors. However when I press the button it tells me that 'torso' is not a valid part of 'localPlayer'. Why is this and what is the correct format for this?
function onClicked()
game.Players.localPlayer.torso.cFrame.new(20, 12, 85)
script.Parent.Parent.Parent:Destroy()
end
script.Parent.MouseButton1Click:connect(onClicked) |
|
C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
function onClicked()
game.Players.LocalPlayer.Torso.CFrame = Vector3.new(20, 12, 85)
script.Parent.Parent.Parent:Destroy()
end
script.Parent.MouseButton1Click:connect(onClicked) |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
Thank you for the reply, however it outputs the same no such thing as players having a 'torso' in the output. |
|
C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
function onClicked()
game.Players.LocalPlayer.Character.Torso.CFrame = Vector3.new(20, 12, 85)
script.Parent.Parent.Parent:Destroy()
end
script.Parent.MouseButton1Click:connect(onClicked) |
|
|
Get the character from the Player before accesing his torso, there's no such thing as "Torso" inside the Player. |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
I have tried messing around with your script to get it to work but just made it worse. Before I messed with it, it gave off this in the output
22:51:44.559 - "Part.cFrame" should be "CFrame" in Players.Player1.PlayerGui.ScreenGui.Frame.ImageButton.Torso
22:51:44.562 - new is not a valid member
22:51:44.565 - Script 'Players.Player1.PlayerGui.ScreenGui.Frame.ImageButton.Torso', Line 2
22:51:44.569 - Stack End
22:51:44.571 - Disconnected event because of exception |
|
|
function onClicked()
game.Players.localPlayer.torso.CFrame.new(20, 12, 85)
script.Parent.Parent.Parent:Destroy()
end
script.Parent.MouseButton1Click:connect(onClicked)
¬¬¬¬¬¬¬¬¬
it tells you to fix what I have fixed above. But that will not work because Torso is not a child of Player. |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
This is quite a problem, without the player containing anything that can be used to move him/her with cFrame; figuring this out will be difficult :o |
|
|
You need to get the Players Character first.
Players.Playername.Character |
|
C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
Are you using a LocalScript?
function onClicked()
game.Players.LocalPlayer.Character.Torso.CFrame = Vector3.new(20, 12, 85)
script.Parent.Parent.Parent:Destroy()
end
script.Parent.MouseButton1Click:connect(onClicked)
..This should work |
|
|
function onClicked()
game.Players.LocalPlayer.Character.Torso.CFrame = CFrame.new(20, 12, 85)
script.Parent.Parent.Parent:Destroy()
end
script.Parent.MouseButton1Click:connect(onClicked) |
|
C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
Awesome, it is a vector3 value.
CFrame = Vector3.new() |
|
YungLimboJoin Date: 2010-11-20 Post Count: 13547 |
function onClicked()
local player = game.Players:GetPlayerFromCharacter
player.Character:MoveTo(Vector3.new(20,12,85))
end
This should work |
|
|
@Duke
It won't. You haven't supplied the necessary argument for GetPlayerFromCharacter(). |
|
|
function onClicked()
game.Players.LocalPlayer.Character.Torso.CFrame = CFrame.new (Vector3.new(20,12,85))
script.Parent.Parent.Parent:Destroy() -- idk what this is
end
script.Parebt.MouseButton1Click:connect(onClicked) |
|
smunkeyJoin Date: 2011-12-17 Post Count: 342 |
Thanks bros. :D |
|
|
try adding a click detector |
|