You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
In my game one of the main mechanics are chases and im trying to add ledge grabbing to add diversity to it. -
What is the issue? Include screenshots / videos if possible!
I’ve made a simple raycast check for the rootpart to check for a part, and one above the torso to check if theres nothing there, and it * mostly * works until i have to actually put the player into place, where it kind of works but only fits well with parts relativelly the size of the character and face the ledge. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried looking at some scripts in the forum but can’t figure out most things, and cant find any tutorials regarding this, only uncopylocked models ( which is not really what im looking for )
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
function detectledge()
if canVault == true then
local lCheck = workspace:Raycast(rootPart.CFrame.Position, rootPart.CFrame.LookVector * 5, raycastParams)
if lCheck then
if lCheck.Instance and not lCheck.Instance.Parent:FindFirstChild("Humanoid") then
local ledgeposition = lCheck.Instance.Position
local headray = workspace:Raycast(rootPart.CFrame.Position + Vector3.new(0, 6, 0), rootPart.CFrame.LookVector * 5, raycastParams)
if headray == nil or not headray then
local magnitude = (ledgeposition - rootPart.Position).Magnitude
if magnitude < 10 then
canVault = false
ledgePart = Instance.new("Part")
ledgePart.Position = lCheck.Position + Vector3.new(0,-2,0)
ledgeconnect = runservice.RenderStepped:Connect(function()
-- grabbing
rootPart.Anchored = true
rootPart.CFrame = ledgePart.CFrame
end)
end
end
end
end
elseif canVault == false then
-- jumping off ledge
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
rootPart.Anchored = false
if ledgeconnect then
ledgeconnect:Disconnect()
end
if ledgePart then
ledgePart:Destroy()
end
canVault = true
end
end