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

Teleport Tool To Position?

Asked by 6 years ago

Hello,

If i want to make a script that will teleport a tool from someones Backpack to a speciall position in the workspace. How do i make that?

0
Find a way to get to the player's backpack then change the tool's parent to Workspace then set the tool's position to the position you would like it to be. Nep_Ryker 131 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

1) You can either clone the tool or just remove it from the backpack, note: if the tool is equipped it is NOT IN BACKPACK BUT IN PLAYERS CHARACTER!

2) To teleport a tool you need to set the CFrame of the handle, not the tool

3) You could fix problem one either by checking if it's in player or char or putting the script inside the tool, I'll do the last one in this example

-- Serverscript

local tool = script.Parent
used = false

while wait() do
    if used == true then
        tool.Parent = workspace
        local handle = tool:FindForChild('Handle')
        handle.CFrame = CFrame.new(Vector3.new(0,0,0))
    end
end

I do not set used to true as I don't know when you want to do the action, remember that it needs a Handle to work!

If you want to* teleport it to another part* use this

-- Serverscript

local tool = script.Parent
used = false

local part = workspace.TeleportPart -- Set this to the part

while wait() do
    if used == true then
        tool.Parent = workspace
        local handle = tool:FindForChild('Handle')
        handle.CFrame = part.CFrame
    end
end
Ad

Answer this question