루아(LUA)/로블록스

순간이동하기 [로블록스 1일 1코딩 #10]

JK77 2022. 2. 12. 06:06

local teleportPart = script.Parent
local destination = game.Workspace.Destination

local function teleport(otherPart)
	local character = otherPart.Parent
	
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	
	destination.Anchored = true
	
	if humanoid then
		humanoid.RootPart.Position = Vector3.new(destination.Position.X, destination.Position.Y*2, destination.Position.Z)
	end
end

teleportPart.Touched:Connect(teleport)