if getgenv().telekinesisUIDestroy then getgenv().telekinesisUIDestroy() end local ts = game:GetService("TweenService") local txts = game:GetService("TextService") local cas = game:GetService("ContextActionService") local uis = game:GetService("UserInputService") local sgui = Instance.new("ScreenGui") local isMobile = uis.TouchEnabled and not uis.KeyboardEnabled local font = Enum.Font.IndieFlower sgui.IgnoreGuiInset = true sgui.Name = "TelekinesisUI" local huifunc = gethui or get_hidden_gui if huifunc then sgui.Parent = huifunc() else sgui.Parent = game.CoreGui end local localplr = game.Players.LocalPlayer local mouse = localplr:GetMouse() local dist = 5 local hoverblock = true local um = false local notouch = false local nocollide = false local showblockpos = true local sbnm = false local pbr = 20 function createElement(classname,properties) local element = Instance.new(classname) for i,v in pairs(properties) do element[i] = v end return element end local mainframe = createElement("Frame",{ Size = UDim2.new(0.2,0,2.5,0), Position = UDim2.new(1,0,0.5,0), AnchorPoint = Vector2.new(0,0.5), BackgroundColor3 = Color3.fromRGB(100,100,100), BorderColor3 = Color3.fromRGB(255,255,255), BorderSizePixel = 3, Parent = sgui }) local scrollingmainframe = createElement("ScrollingFrame",{ Size = UDim2.new(1,0,0.825,0), Position = UDim2.new(0,0,0.175,0), AnchorPoint = Vector2.new(0,0), BackgroundColor3 = Color3.fromRGB(100,100,100), BorderColor3 = Color3.fromRGB(255,255,255), BorderSizePixel = 3, ScrollingDirection = Enum.ScrollingDirection.Y, CanvasSize = UDim2.new(0,0,4,0), Parent = mainframe }) createElement("UIAspectRatioConstraint",{ AspectRatio = 0.75, Parent = mainframe }) local openclosearrow = createElement("TextButton",{ Size = UDim2.new(0.15,0,0.25,0), Position = UDim2.new(0,-3,0.5,0), AnchorPoint = Vector2.new(1,0.5), TextScaled = true, Font = font, Text = "<", BackgroundColor3 = Color3.fromRGB(100,100,100), TextColor3 = Color3.fromRGB(255,255,255), BorderColor3 = Color3.fromRGB(255,255,255), BorderSizePixel = 3, Parent = mainframe }) local opened = false openclosearrow.MouseButton1Click:Connect(function() opened = not opened local positioning if opened then positioning = Vector2.new(1,0.5) openclosearrow.Text = ">" else positioning = Vector2.new(0,0.5) openclosearrow.Text = "<" end local tween = ts:Create(mainframe,TweenInfo.new(0.5,Enum.EasingStyle.Exponential,Enum.EasingDirection.Out,0,false,0),{AnchorPoint = positioning}) tween:Play() end) createElement("TextLabel",{ Size = UDim2.new(1,0,0.1,0), Position = UDim2.new(0,0,0,0), TextScaled = true, Font = font, Text = "Telekinesis Script", BackgroundColor3 = Color3.fromRGB(90,90,90), TextColor3 = Color3.fromRGB(255,255,255), BorderColor3 = Color3.fromRGB(255,255,255), BorderSizePixel = 3, Parent = mainframe }) createElement("TextLabel",{ Size = UDim2.new(1,0,0.075,0), Position = UDim2.new(0,0,0.1,0), TextScaled = true, Font = font, Text = "Made By 2AreYouMental110", BackgroundColor3 = Color3.fromRGB(75,75,75), TextColor3 = Color3.fromRGB(255,255,255), BorderColor3 = Color3.fromRGB(255,255,255), BorderSizePixel = 3, Parent = mainframe }) local dragging = {} function dragtopo2s(fpos,spos,pos,frame,bounds,ar,dragx) local finalpos = UDim2.new( frame.Position.X.Scale, --spos.X.Scale+(fpos.X.Scale-pos.X.Scale), (dragx and spos.X.Offset-(fpos.X.Offset-pos.X)) or frame.Position.X.Offset, frame.Position.Y.Scale, --spos.Y.Scale+(fpos.Y.Scale-pos.Y.Scale), spos.Y.Offset-(fpos.Y.Offset-pos.Y) ) frame.Position = finalpos end local drag = function(frame,bounds,chf,dragx) local frames = {} if frame:IsA("ScreenGui") then for i,v in pairs(frame:GetChildren()) do if chf ~= nil and (v:IsA("Frame") or v:IsA("ScrollingFrame")) then table.insert(frames,v) elseif not chf then table.insert(frames,v) end end else table.insert(frames,frame) end for i,frame in pairs(frames) do frame.Active = true -- uhh local w,h = frame.AbsoluteSize.X,frame.AbsoluteSize.Y local ar = w/h frame.InputBegan:Connect(function(input) if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) and not dragging[input] then dragging[input] = frame local firstpos = UDim2.new(0,mouse.X,0,mouse.Y) local startpos = frame.Position local move1 = uis.TouchMoved:Connect(function(input2) if input == input2 then dragtopo2s(firstpos,startpos,input2.Position,frame,bounds or nil,ar,dragx) end end) local move2 = uis.InputChanged:Connect(function(input2) if input2.UserInputType == Enum.UserInputType.MouseMovement then dragtopo2s(firstpos,startpos,input2.Position,frame,bounds or nil,ar,dragx) end end) repeat task.wait() until dragging[input] == nil move1:Disconnect() move2:Disconnect() end end) uis.InputEnded:Connect(function(input) dragging[input] = nil end) uis.InputBegan:Connect(function(input) dragging[input] = true end) end end drag(mainframe) local kbselectfunc = function() return true end function getinputname(inputs) local inputstr = "" if typeof(inputs) ~= "table" then inputs = {inputs} end for i,input in pairs(inputs) do if input.Name and input.Name ~= "Unknown" then inputstr = inputstr..input.Name elseif input.KeyCode then inputstr = inputstr..input.KeyCode.Name elseif input.UserInputType then inputstr = inputstr..input.UserInputType.Name end if i ~= #inputs then inputstr = inputstr.." + " end end return inputstr end local keybinds = {} local keybindindex = 0 local mobilekeybinds = {} local helddown = {} function registerheld(keycode) helddown[keycode] = false end registerheld(Enum.KeyCode.LeftControl) registerheld(Enum.KeyCode.LeftShift) registerheld(Enum.KeyCode.LeftAlt) registerheld(Enum.KeyCode.RightControl) registerheld(Enum.KeyCode.RightShift) registerheld(Enum.KeyCode.RightAlt) function gettextbounds(txt) local params = Instance.new("GetTextBoundsParams") params.Text = txt params.Font = Font.fromEnum(font) params.Size = 12 params.Width = 20000 return txts:GetTextBoundsAsync(params) end local buttonsize = UDim2.new(0.4,0,0.075,0) local buttonspacing = 0.01 local index = -1 function setPosition(element) index += 1 local yamount = math.floor(index/2) * buttonsize.Y.Scale + (math.floor(index/2)*buttonspacing) + buttonspacing if index%2 == 0 then element.AnchorPoint = Vector2.new(0,0) element.Position = UDim2.new(0.05,0,yamount,0) else element.AnchorPoint = Vector2.new(1,0) element.Position = UDim2.new(0.95,-12,yamount,0) end end function createKeybind(text,keybind,onpressed,mobilekbbutton) keybindindex += 1 local mobilekeybindframe local mobilekeybindbutton local currentkeybindindex = keybindindex local keybindframe = createElement("Frame",{ Size = buttonsize, BackgroundColor3 = Color3.fromRGB(50,50,50), BorderColor3 = Color3.fromRGB(255,255,255), BorderSizePixel = 0, Parent = scrollingmainframe }) if (isMobile and not mobilekbbutton) or not isMobile then createElement("TextLabel",{ Size = UDim2.new(1,0,0.3,0), Position = UDim2.new(0,0,0,0), TextScaled = true, Font = font, Text = text, BackgroundColor3 = Color3.fromRGB(60,60,60), TextColor3 = Color3.fromRGB(255,255,255), BorderColor3 = Color3.fromRGB(255,255,255), BorderSizePixel = 0, Parent = keybindframe }) end local mobiletoggle = false local function gettext() return (isMobile and mobilekbbutton and "Click to Edit ("..text..")") or (isMobile and text..": "..((mobiletoggle and "On") or "Off")) or ("Click to Change ("..getinputname(keybind)..")") end local changekbbutton = createElement("TextButton",{ Size = (isMobile and UDim2.new(1,0,1,0)) or (UDim2.new(1,0,0.7,0)), Position = (isMobile and UDim2.new(0,0,0,0)) or (UDim2.new(0,0,0.3,0)), TextScaled = true, Font = font, Text = gettext(), BackgroundColor3 = Color3.fromRGB(35,35,35), TextColor3 = Color3.fromRGB(255,255,255), BorderColor3 = Color3.fromRGB(255,255,255), BorderSizePixel = 0, Parent = keybindframe }) changekbbutton.MouseButton1Click:Connect(function() if isMobile and not mobilekbbutton then mobiletoggle = not mobiletoggle mobilekeybinds[currentkeybindindex].bool = mobiletoggle changekbbutton.Text = text..": "..((mobiletoggle and "On") or "Off") else local pass = kbselectfunc(text) if pass then local deselected = false kbselectfunc = function(btext) deselected = true changekbbutton.Text = gettext() if mobilekeybindbutton.Interactable == false then mobilekeybindbutton.Interactable = true return false end if changekbbutton.Text == "Press a Key" then changekbbutton.Text = gettext() return false end return true end changekbbutton.Text = (isMobile and "Drag the button, tap here again to finish") or "Press a Key" if isMobile then mobilekeybindbutton.Interactable = false else local good = false repeat local input, processed = uis.InputBegan:Wait() if not processed and helddown[input.KeyCode] == nil then keybind = {} for i,v in pairs(helddown) do if v then table.insert(keybind,i) end end if input.KeyCode and input.KeyCode.Name ~= "Unknown" then table.insert(keybind,input.KeyCode) else table.insert(keybind,input.UserInputType) end changekbbutton.Text = gettext() good = true end until good == true end keybinds[currentkeybindindex] = { keybind = keybind, OnPressed = onpressed } end end end) if isMobile and mobilekbbutton then local txtb = gettextbounds(text) mobilekeybindframe = createElement("Frame",{ Size = UDim2.new(0,txtb.X+5,0,22), BackgroundColor3 = Color3.fromRGB(50,50,50), BorderColor3 = Color3.fromRGB(255,255,255), BorderSizePixel = 2, Parent = sgui }) drag(mobilekeybindframe,nil,nil,true) mobilekeybindbutton = createElement("TextButton",{ Size = UDim2.new(1,0,1,0), Position = UDim2.new(0,0,0,0), TextSize = 12, Font = font, Text = text, BackgroundColor3 = Color3.fromRGB(50,50,50), TextColor3 = Color3.fromRGB(255,255,255), BorderColor3 = Color3.fromRGB(255,255,255), BorderSizePixel = 0, Parent = mobilekeybindframe }) mobilekeybindbutton.MouseButton1Click:Connect(function() onpressed() end) end keybinds[currentkeybindindex] = { keybind = keybind, OnPressed = onpressed } if isMobile and not mobilekbbutton then mobilekeybinds[currentkeybindindex] = { bool = mobiletoggle, OnPressed = onpressed } end setPosition(keybindframe) return keybindframe, mobilekeybindframe end function verifyInput(keybinds,input) if typeof(keybinds) == "table" then local correct = true for i,v in pairs(keybinds) do if v ~= input.KeyCode and v ~= input.UserInputType and not helddown[v] then correct = false end end return correct else return input.KeyCode == keybinds or input.UserInputType == keybinds end end local oninput = uis.InputBegan:Connect(function(input,gp) if gp and (not isMobile or not mouse.Target or not mouse.Target:FindFirstChildWhichIsA("DragDetector")) then return end for i,v in pairs(keybinds) do if verifyInput(v.keybind,input) then v.OnPressed() end end if input.KeyCode then for i,v in pairs(helddown) do if i == input.KeyCode then helddown[i] = true end end end if isMobile and (input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1) then for i,v in pairs(mobilekeybinds) do if v.bool then v.OnPressed() end end end end) local oninputend = uis.InputEnded:Connect(function(input,gp) if gp then return end if input.KeyCode then for i,v in pairs(helddown) do if i == input.KeyCode then helddown[i] = false end end end end) function createToggle(text,bool,ontoggle) local togglebutton = createElement("TextButton",{ Size = buttonsize, Position = UDim2.new(0,0,0.3,0), TextScaled = true, Font = font, Text = text..": "..((bool and "On") or "Off"), BackgroundColor3 = Color3.fromRGB(35,35,35), TextColor3 = Color3.fromRGB(255,255,255), BorderColor3 = Color3.fromRGB(255,255,255), BorderSizePixel = 0, Parent = scrollingmainframe }) togglebutton.MouseButton1Click:Connect(function() bool = not bool togglebutton.Text = text..": "..((bool and "On") or "Off") ontoggle(bool) end) ontoggle(bool) setPosition(togglebutton) return togglebutton end function createButton(text,onpressed) local button = createElement("TextButton",{ Size = buttonsize, Position = UDim2.new(0,0,0.3,0), TextScaled = true, Font = font, Text = text, BackgroundColor3 = Color3.fromRGB(35,35,35), TextColor3 = Color3.fromRGB(255,255,255), BorderColor3 = Color3.fromRGB(255,255,255), BorderSizePixel = 0, Parent = scrollingmainframe }) button.MouseButton1Click:Connect(onpressed) setPosition(button) return button end function createTextBox(text,oninput) local textbox = createElement("TextBox",{ Size = buttonsize, Position = UDim2.new(0,0,0.3,0), TextScaled = true, Font = font, PlaceholderText = text, Text = "", BackgroundColor3 = Color3.fromRGB(35,35,35), TextColor3 = Color3.fromRGB(255,255,255), BorderColor3 = Color3.fromRGB(255,255,255), BorderSizePixel = 0, Parent = scrollingmainframe }) textbox.FocusLost:Connect(function() oninput(textbox.Text) end) setPosition(textbox) return textbox end local lastsuccessfulcfr = CFrame.new() function getcfr(customdist) local customdist = customdist or dist local offset if localplr.Character and localplr.Character:FindFirstChild("Head") then local plrpos = localplr.Character.Head.Position local topos = plrpos if um then topos = mouse.Hit.Position end offset = (topos - (workspace.CurrentCamera.CFrame.Position - (workspace.CurrentCamera.CFrame.LookVector))).Unit * customdist lastsuccessfulcfr = (CFrame.new(offset) * workspace.CurrentCamera.CFrame.Rotation) + plrpos end return lastsuccessfulcfr, offset end local lastsuccessfulcfr2 = CFrame.new() function getplrcfr() if localplr.Character and localplr.Character:FindFirstChild("HumanoidRootPart") then lastsuccessfulcfr2 = localplr.Character.HumanoidRootPart.CFrame end return lastsuccessfulcfr2 end local isnetworkowner = isnetworkowner or function(part) if part.Anchored == true then return false end if part:IsGrounded() then return false end if part.ReceiveAge == 0 then return true end return false end function returnnetworkcolor(block) if not block or not typeof(block) == "Instance" or not block:IsA("BasePart") then return Color3.fromRGB(255,0,0) end return (isnetworkowner(block) and Color3.fromRGB(0,255,0)) or Color3.fromRGB(255,0,0) end local bodygyro = Instance.new("BodyGyro") bodygyro.CFrame = CFrame.new() bodygyro.MaxTorque = Vector3.new(math.huge,math.huge,math.huge) local bodyposition = Instance.new("BodyPosition") bodyposition.MaxForce = Vector3.new(math.huge,math.huge,math.huge) local blockselectbox = Instance.new("SelectionBox") blockselectbox.LineThickness = 0.1 blockselectbox.Color3 = Color3.fromRGB(0,0,0) local indicatepos = createElement("Part",{ Material = Enum.Material.ForceField, Size = Vector3.new(4,4,4), Shape = Enum.PartType.Ball, Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false, CastShadow = false, Name = "IndicatePos", Parent = workspace }) local linetemplate = Instance.new("LineHandleAdornment") linetemplate.Thickness = 10 linetemplate.Transparency = 0 linetemplate.ZIndex = 999 linetemplate.Parent = sgui local adorntotemplate = createElement("Part",{ Size = Vector3.new(1,1,1), Transparency = 1, Anchored = true, CanCollide = false, CanQuery = false, CanTouch = false, CastShadow = false, Name = "AdornTo" }) local selectedblocks = {} function blockselect(block) if not block or not typeof(block) == "Instance" or not block:IsA("BasePart") then return false end local sblock = selectedblocks[block] if sblock then for i,v in pairs(sblock.connections) do v:Disconnect() end for i,v in pairs(sblock.instances) do if v then v:Destroy() end end block.CanTouch = sblock.originaltouch block.CanCollide = sblock.originalcollide selectedblocks[block] = nil local count = 0 for i,v in pairs(selectedblocks) do if i and i.Parent then count += 1 else blockselect(i) end end if count == 0 then dist = 5 end return false else selectedblocks[block] = { connections = {}, instances = {}, update = true, updatepos = getcfr().Position, originaltouch = block.CanTouch, originalcollide = block.CanCollide } if notouch then block.CanTouch = false end if nocollide then block.CanCollide = false end local bg = bodygyro:Clone() local bp = bodyposition:Clone() local bsb = blockselectbox:Clone() local line = linetemplate:Clone() local adornto = adorntotemplate:Clone() selectedblocks[block].instances.bodygyro = bg selectedblocks[block].instances.bodypos = bp selectedblocks[block].instances.selectbox = bsb selectedblocks[block].instances.line = line selectedblocks[block].instances.adornto = adornto bg.Parent = (hoverblock and block) or sgui bp.Parent = block bsb.Parent = block bsb.Adornee = block bsb.Color3 = returnnetworkcolor(block) line.Adornee = adornto line.Parent = sgui adornto.Parent = workspace return selectedblocks[block] end end local simr = 50 local recentlythrown = {} local bsparams = OverlapParams.new() local onrender = game:GetService("RunService").RenderStepped:Connect(function() debug.profilebegin("TelekinesisFE") local pos = getcfr().Position indicatepos.Transparency = (showblockpos and 0) or 1 local poscolor if showblockpos then indicatepos.Position = pos poscolor = Color3.fromHSV((tick()/5)%1,1,1) indicatepos.Color = poscolor end if sbnm then local plrpos = getplrcfr().Position local gp = game.Players:GetPlayers() local characters = {} for i,v in pairs(gp) do if v.Character then table.insert(characters,v.Character) end end bsparams.ExcludeInstances = characters local parts = workspace:GetPartBoundsInRadius(plrpos,pbr,bsparams) for i,v in pairs(parts) do if v.Anchored == false and not v:IsGrounded() and not selectedblocks[v] and not recentlythrown[v] then blockselect(v) end end end for i,v in pairs(selectedblocks) do if not i or not i.Parent then blockselect(i) end if v.update then v.updatepos = pos end v.instances.bodypos.Position = v.updatepos v.instances.selectbox.Color3 = returnnetworkcolor(i) if showblockpos then local sub = (i.Position - v.updatepos) local mag = sub.Magnitude - 2 v.instances.adornto.CFrame = CFrame.new(i.Position) v.instances.line.CFrame = CFrame.lookAt(i.Position,v.updatepos).Rotation v.instances.line.Length = mag v.instances.line.Color3 = poscolor v.instances.line.Visible = true else v.instances.line.Visible = false end end localplr.SimulationRadius = simr debug.profileend() end) local selectblockkb, mobileselectblockkb = createKeybind("Block Selection",Enum.KeyCode.R,function() blockselect(mouse.Target) end) local hoverb = createToggle("Hover Block",true,function(bool) hoverblock = bool for i,v in pairs(selectedblocks) do v.instances.bodygyro.Parent = (bool and i) or sgui end end) local incd,mb = createKeybind("Increase Distance",{Enum.KeyCode.LeftControl,Enum.KeyCode.E},function() dist += 10 end,true) if mb then mb.AnchorPoint = Vector2.new(1,1) mb.Position = UDim2.new(0.75,0,0.6,0) end local dcd,mb = createKeybind("Decrease Distance",{Enum.KeyCode.LeftControl,Enum.KeyCode.Q},function() dist -= 10 end,true) if mb then mb.AnchorPoint = Vector2.new(1,1) mb.Position = UDim2.new(0.8,0,0.7,0) end local throwspeed = 200 local tb,mb = createKeybind("Throw Block",Enum.KeyCode.Y,function() for i,v in pairs(selectedblocks) do recentlythrown[i] = true for i,v in pairs(v.connections) do v:Disconnect() end for i,v in pairs(v.instances) do if v then v:Destroy() end end local _,velocity = getcfr(throwspeed) if i and isnetworkowner(i) then i.Velocity = velocity end selectedblocks[i] = nil coroutine.wrap(function() task.wait(0.3) if i then i.CanTouch = v.originaltouch i.CanCollide = v.originalcollide end task.wait(1.7) recentlythrown[i] = nil end)() end end,true) if mb then mb.AnchorPoint = Vector2.new(1,1) mb.Position = UDim2.new(0.8,0,0.8,0) end local tstb = createTextBox("Throw Speed (default: 200)",function(text) throwspeed = tonumber(text) end) local tb = createKeybind("Select Freeze Block",Enum.KeyCode.F,function() local sblock = selectedblocks[mouse.Target] if sblock then selectedblocks[mouse.Target].update = not sblock.update if sblock.update then sblock.instances.selectbox.SurfaceTransparency = 1 dist = 5 else sblock.instances.selectbox.SurfaceTransparency = 0.5 end end end) local umb = createToggle("Use mouse for telekinesis",false,function(bool) um = bool end) local notouchbutton = createToggle("Non-touchable blocks (prevents dying)",false,function(bool) notouch = bool for i,v in pairs(selectedblocks) do if notouch then i.CanTouch = false else i.CanTouch = v.originaltouch end end end) local nocollidebutton = createToggle("Non-Collidable blocks (prevents getting flung)",false,function(bool) nocollide = bool for i,v in pairs(selectedblocks) do if nocollide then i.CanCollide = false else i.CanCollide = v.originalcollide end end end) local srtb = createTextBox("Simulation Radius (pickup block radius, default: 50)",function(text) simr = tonumber(text) end) local showblockpos = createToggle("Indicate Block Repositioning",true,function(bool) showblockpos = bool end) local showblockpos = createToggle("Auto select blocks near me",false,function(bool) sbnm = bool end) local apbrtb = createTextBox("Auto select block radius (default: 20)",function(text) pbr = tonumber(text) end) getgenv().telekinesisUIDestroy = function() sgui:Destroy() oninput:Disconnect() oninputend:Disconnect() onrender:Disconnect() for i,v in pairs(selectedblocks) do for i,v in pairs(v.connections) do v:Disconnect() end for i,v in pairs(v.instances) do if v then v:Destroy() end end i.CanTouch = v.originaltouch i.CanCollide = v.originalcollide selectedblocks[i] = nil end indicatepos:Destroy() end