so basically I’ve been trying to make this
but this is the closest thing I can get to getting what I want but I don’t know how to achieve it
can anyone help me please
I’m about to go insane
this is the script in startercharacterscripts
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local root = char:WaitForChild("HumanoidRootPart")
local head = char:WaitForChild("Head")
local hum = char:WaitForChild("Humanoid")
local ha = hum:LoadAnimation(script:WaitForChild('ha'))
local tg = plr:WaitForChild("PlayerGui"):FindFirstChild("TouchGui")
local uis = game:GetService("UserInputService")
local ledgeavailable = true
local holding = false
local function c()
local velo = Instance.new("BodyVelocity",root)
root.Anchored = false
velo.MaxForce = Vector3.new(1,1,1) * math.huge
velo.Velocity = root.CFrame.LookVector * 10 + Vector3.new(0,30,0)
ha:Stop()
game.Debris:AddItem(velo,.15)
holding = false
char:WaitForChild('Torso').Anchored = false
wait(.75)
ledgeavailable = true
end
local function onInputBegan(input, gameProcessed)
if not holding then return end
if input.KeyCode == Enum.KeyCode.Space and not gameProcessed then
c()
end
end
local function onJumpButtonClicked()
if not holding then return end
c()
end
uis.InputBegan:Connect(onInputBegan)
if tg then
local jumpButton = tg:WaitForChild("TouchControlFrame"):WaitForChild("JumpButton")
jumpButton.MouseButton1Click:Connect(onJumpButtonClicked)
end
while true do
local r = Ray.new(head.CFrame.p, head.CFrame.LookVector * 3)
local part,position = workspace:FindPartOnRay(r,char)
if part and ledgeavailable and not holding then
if part.Size.Y >= 7 then
if head.Position.Y >= (part.Position.Y + (part.Size.Y / 2)) - 1 and head.Position.Y <= part.Position.Y + (part.Size.Y / 2) and root.Velocity.Y <= 0 then
for _, descendant in ipairs(workspace.uwu:GetDescendants()) do
if descendant:IsA("Part") then
local partpos = descendant.Position
local t = char:WaitForChild('Torso')
local playerpos = t.CFrame.Position
local lookAt = Vector3.new(partpos.X, playerpos.Y, partpos.Z)
root.Anchored = true
holding = true
ha:Play()
ledgeavailable = false
t.Anchored = true
t.CFrame = CFrame.lookAt(playerpos, lookAt)
end
end
end
end
end
wait()
end```