Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a teleportation script for my admin panel?

I already got the basics down, what I am trying to do now is move the plr's location to be right in front of the target.

script.Parent.MouseButton1Click:Connect(function()
	
	local plr = game.Players.LocalPlayer
	local targetName = script.Parent.Parent.TextBox.Text
	local target = game.Players:findFirstChild(targetName)
	local human = plr.Character.Humanoid
	
	
	
end)

1 answer

you can take your characters primary part and cframe it to be in front of the targets primary part.

local targetCFrame = target.Character.PrimaryPart.CFrame:ToWorldSpace(CFrame.new(0,0,-5))

plr.Character:SetPrimaryPartCFrame(targetCFrame)

if youre unfamiliar with CFrames, the :ToWorldSpace() basically takes its argument to be the relative displacement from the targets character cframe and outputs corrosponding workspace cframe for you to use for positioning your character. i made it to be 5 units in front of the target, but you can play with that number to be whatever you like

This discussion is preserved as it was. New answers, comments, and votes are closed.