Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with wall climbing script? [Edited][Unsolved]

Asked by 8 years ago

The goal of this script is to detect a player jumping in the direction of a wall and allow them to climb it using bodyvelocity, but it does'nt work, and gives out no errors or messages. Code

local climb_speed = 9
local permit_wallhudding = true
local stick_distance = 3



function testPrime(p)
    local i = 2
    while i < p do
        if p % i == 0 then
            return false
end
i = i + 1
end
return true
end

local i = 0
local p = {2,3}

while i < #p do
    wait()
    i = i + 1   
    p[i+2] = i*i
end


function onD(h)
    if h.Name == "Torso" then
        follow(h)
end
end
game.Workspace.DescendantAdded:connect(onD)

function push(a)
    a.maxForce = Vector3.new(0,10^5,0)
end
function stop(a)
    a.maxForce = Vector3.new(0,0,0)
end

function castForward(p)
    local r = Ray.new(p.Position-Vector3.new(0,3.5,0),p.CFrame.lookVector*stick_distance)
    local k,t = workspace:FindPartOnRay(r,p.Parent)
    print(k,t)
    return k,t
end

function follow(t)
    wait(1)
    local h = t.Parent.Humanoid
    local v = Instance.new("BodyVelocity")
    v.velocity = Vector3.new(0,climb_speed,0)
    stop(v)
    v.Parent = t
    print("Got " .. tostring(t.Parent))
    while true do
        wait()
        if t.Parent == nil or t.Parent.Parent == nil then
            return
end
--Start Code
if h.Jump and castForward(t) ~= nil then
    push(v)
    print("ON")
else
    stop(v)
end

--End Code
end
end

Thanks(tabbed)

0
ew ew ew, un-tabbed script NotSoNorm 777 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Call the functions to run?

0
it is being called already pluginfactory 463 — 8y
Ad

Answer this question