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

More efficient walljump script?

Asked by
iNicklas 215 Moderation Voter
9 years ago
enabled = true
function onTouched(hit)
    if not enabled then return end
    enabled = false 
    local h = hit.Parent:findFirstChild("Humanoid")
    if (h ~= nil) then
        h.Sit = true
    end
    enabled = true 
end 
script.Parent.Touched:connect(onTouched) 

*Yes i know this is just a script making your character sit, but i'm not a master scripter. And when i ask for help here i get -6 reputation. So please be nice.

(no negativity allowed)

0
I'll just add the bottom half of your Question WILL end up giving you Negative rep alphawolvess 1784 — 9y
0
i edited it, it still means the same. iNicklas 215 — 9y
0
What do you want? davness 376 — 9y

1 answer

Log in to vote
3
Answered by 9 years ago

Simple! By wall jump i would assume you want to jump away form the wall. All we need to do here is add some velocity. Now a normal Vector3 would not work in this case because it would make the player jump on a specific x or z axis rather than where you want it to go. This can be fixed using a LookVector. the most efficient way to walljump is to jump backwards. A natural speed for a character to jump is 30 sps (Studs per Second). So try this!

enabled = true
function onTouched(hit)
    if not enabled then return end
    enabled = false 
    local h = hit.Parent:findFirstChild("Humanoid")
    if (h ~= nil) then
        h.Sit = true
        h.Parent.Torso.Velocity = h.Parent.Torso.CFrame.lookVector * -30 --this makes it so the player will jump in the opposite direction it is facing
    end
    enabled = true 
end 
script.Parent.Touched:connect(onTouched) 

0
Thank you Link!, you are indeed the hero of time :D iNicklas 215 — 9y
0
No problem! minikitkat 687 — 9y
Ad

Answer this question