I am making a 2D platformer game, I have nailed the control and camera, I just need help with the teleport lava (Lava that TP's you to start) scripts. Currently I have this
function onTouched(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then -- Because object "hit" is just "Left Leg" or "Right Leg" game.Workspace.???.Torso.CFrame = CFrame.new(Vector3.new(-43, 10, 13)) end end script.Parent.Touched:connect(onTouched)
The ??? is what I am stuck on. I need help on identifying a certain Instance by Name, not ClassName.
If you are just trying to get the torso of the player that touched it, just use hit.Parent
since that would point to the character
object.
function onTouched(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then -- Because object "hit" is just "Left Leg" or "Right Leg" hit.Parent.Torso.CFrame = CFrame.new(Vector3.new(-43, 10, 13)) end end script.Parent.Touched:connect(onTouched)