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

How do I make a part teleport to a players current position?

Asked by 4 years ago
Edited 4 years ago

How do I make a script that teleports a part (called part1) to the player's current position?

Here is my current script so far:

function onClicked(hit) 


workspace.part1.Position = Vector3.new()


end

script.Parent.MouseButton1Click:connect(onClicked)
0
i changed mine iuclds 720 — 4y

2 answers

Log in to vote
-1
Answered by
0msh 333 Moderation Voter
4 years ago

you showed little to no effort in your script so here you go

function onClicked(hit) 


workspace.part1.CFrame = workspace:FindFirstChild(script.Parent.Parent.Parent.Name) -- change this


end

script.Parent.MouseButton1Click:connect(onClicked)
0
What should I change inside of the bracket? earlgrey2014 -4 — 4y
0
This shows little to no effort in this script. Try making it simpler. iuclds 720 — 4y
Ad
Log in to vote
-1
Answered by
iuclds 720 Moderation Voter
4 years ago
Edited 4 years ago
local PartToTeleport = game.Players.LocalPlayer.Character.HumanoidRootPart
local PartToBring = workspace.Part2

local Offset = CFrame.new(0,1,0)

script.Parent.MouseButton1Click:Connect(function()
       PartToTeleport.CFrame = PartToBring.CFrame * Offset
end)
1
How do I make the part go to the player specifically? earlgrey2014 -4 — 4y
0
Oh, player? iuclds 720 — 4y

Answer this question