hi, i was working on a teleport tool, but it dosent work fully :l ... what did i do wrong?

local deb = false

script.Parent.Deselected:connect(function()
	if deb == true then
local me = game.Players.LocalPlayer
local char = game.Players.LocalPlayer.Character
		if char then
			char:BreakJoints()
		end
		end
end)


script.Parent.Selected:connect(function(m)
	m.Button1Down:connect(function(mouse)
		if deb == false then deb = true
local me = game.Players.LocalPlayer
local char = game.Players.LocalPlayer.Character
		if char:findFirstChild("Torso") and m.Target ~= nil then
			local parts = {"Right Leg", "Left Leg", "Torso", "Right Arm", "Left Arm", "Head"}
			for _,v in ipairs(parts) do
			local smoke = Instance.new("Smoke")
			smoke.Color = BrickColor.new("Bright blue").Color
			smoke.Enabled = true
			smoke.Opacity = .5
			smoke.RiseVelocity = 0
			smoke.Size = .05
			local smoke2 = Instance.new("Smoke")
			smoke2.Color = BrickColor.new("Bright blue").Color
			smoke2.Enabled = true
			smoke2.Opacity = .5
			smoke2.RiseVelocity = 0
			smoke2.Size = .05
				smoke2.Parent = char:FindFirstChild(v)
				local limb = char:FindFirstChild(v)
				if limb then
					wait(0.2)
						limb.Transparency = .5
				end
			end
			local h = char:findFirstChild("Torso")
			h.CFrame = CFrame.new(m.Hit.p) + Vector3.new(0,4,0)
			local parts = {"Right Leg", "Left Leg", "Torso", "Right Arm", "Left Arm", "Head"}
			for qq,oo in ipairs(parts) do
				for vvv = 1,2 do
				char:FindFirstChild(oo):FindFirstChild("Smoke"):Destroy()
				end
				local limb = char:FindFirstChild(oo)
				if limb then
					wait(0.01)
						limb.Transparency = 0
				end
			end
		end
		deb = false
		end
	end)
end)

3 comments

0

why are you teleporting all the parts indivitually you could simple use MoveTo(), but if it works for you :/

0

cause it is a tool ... i know how to do the moveto() i did it for an npc ... :l

1

But MoveTo works for all models, if im not mistaken