Ever wanted to make a rock climbing game but don’t know how?
Well I have great news, here is this rock climbing feature. You can climb terrain by jumping towards the rock face. This puts your character into the climbing state by an invisible truss part.
To get a copy please check out the link! It uses parallel luau which requires an actor
local freefall=false
local Character=game.Players.LocalPlayer.Character
local Hum=Character.Humanoid
local climbingpart=Instance.new("TrussPart")
climbingpart.Anchored=true
climbingpart.Size=Vector3.new(2,4,2)
climbingpart.Transparency=1
climbingpart.Parent=workspace
climbingpart.CanTouch=false
local Root = Character:WaitForChild("HumanoidRootPart")
local Roothalf= (Root.Size.Y / 2)
local rate=.0666
local lengthvector=(Root.Size.Z*.5)+1.5
local writetime=os.time()
local refreshrate=20
local params = RaycastParams.new()
task.synchronize()
params.FilterDescendantsInstances = {workspace.Terrain}--{Character, workspace:FindFirstChild("Enemys"), workspace:FindFirstChild("NPCS"), workspace:FindFirstChild("GroundItems"), workspace:FindFirstChild("Houses")}
params.FilterType=Enum.RaycastFilterType.Include
local function performRaycast(origin, direction, params)
return workspace:Raycast(origin, direction, params)
end
local function setupRaycastParams()
local timer=os.time()
if timer>writetime+refreshrate then
writetime=timer
params = RaycastParams.new()
task.synchronize()
params.FilterDescendantsInstances = {workspace.Terrain}--{Character, workspace:FindFirstChild("Enemys"), workspace:FindFirstChild("NPCS"), workspace:FindFirstChild("GroundItems"), workspace:FindFirstChild("Houses")}
params.FilterType=Enum.RaycastFilterType.Include
task.desynchronize()
end
return params
end
Hum.Running:ConnectParallel(function()
freefall=false
end)
Hum.FreeFalling:ConnectParallel(function()
freefall=true
end)
Hum.Swimming:ConnectParallel(function()
freefall=false
end)
local lastpos=nil
Hum.Jumping:ConnectParallel(function()
freefall=true
task.wait(.2)
local params = setupRaycastParams()
local Root=Character.HumanoidRootPart
repeat
local Rootpos=Root.Position
if Rootpos~=lastpos then
lastpos=Rootpos
task.synchronize()
local result = performRaycast(Rootpos+Vector3.new(0,Roothalf,0), Root.CFrame.LookVector * lengthvector, params)
task.desynchronize()
local Yoffset=Rootpos.Y + Roothalf
if result then--and not otherResult then
local hitPart = result.Instance
if (hitPart.Name=="Terrain") then
task.synchronize()
if not climbingpart.CanCollide then climbingpart.CanCollide=true end
climbingpart.CFrame=CFrame.new(result.Position-(result.Normal*.75))
if freefall==false then
climbingpart.CanCollide=false
end
task.desynchronize()
task.wait(rate)
end
end
else task.wait(rate)
end
task.wait(rate)
until (freefall==false)
end)
I looked at the performance
the Original was running .777% on the highest this new version runs .050% maximum! Fully implemented parallel luau caused this performance boost.
This is what it is doing in the background!
Grab yourself a free copy and show support by leaving a like and a thumbs up! Check out my topics for other open source projects!
Rock Climbing Demo - Roblox
This new version has almost no backend and is based on the climbing state and climbing features of ladders.
How cool is this feature?
- Yes
- No
- Undecided
0 voters