#help with attaching to walls

12 messages · Page 1 of 1 (latest)

thick falcon
#

I want to make a walljump mechanic, but I need a way to make a player get attached to a wall first. My current localscript is this:

local plr = game.Players.LocalPlayer
local char = plr.Character

local isAttached = false

char:WaitForChild("Humanoid").Touched:Connect(function(p)
if p:IsA("Part") and p:FindFirstChild("_Wall") and isAttached == false then
isAttached = true
print("Player is touching a walljump")
spawn(function()
count()
end)

end

end)

function count()
--Counting down 3 seconds and changing is attached to false
for i = 3, 0, -1 do
wait(1)
print(i)
if i == 0 then
isAttached = false
end
end
end

tired slate
#

Just do wait(3)

#

And then isAttached

#

Or if you want the countdown

#

Just forget that if statement

#

And do IsAttached = not (i == 0)

#

About attaching, just use a weld at the players humanoidrootpart and another attachment at the wall

thick falcon
#

roblox ai made the attaching with welds

#

i use that count function like that because im afraid that if I use a wait it will pause the execution of the rest of the script

#

by how I understand when you spawn() a function it runs independently so that count wont interfere with the rest of the script

#

becauseI still need to detect space bar presses