How do I make this script work with walls with a certain name?
local player = game.Players.LocalPlayer
player.CharacterAdded:wait()
local character = player.Character
local torso = character:WaitForChild("Torso")
local mouse = player:GetMouse()
local humanoid = character:WaitForChild("Humanoid")
local lastwall = nil
mouse.KeyDown:connect(function(key)
if string.byte(key) == 48 then
local ray = Ray.new(
torso.CFrame.p, torso.CFrame.lookVector *2
)
local hit, position, normal = workspace:FindPartOnRay(ray, character)
if hit then
if hit ~= lastwall then
local velo = Instance.new("BodyVelocity",torso)
velo.MaxForce = Vector3.new(300000,300000,300000)
velo.Velocity = -torso.CFrame.lookVector*40 + Vector3.new(0,50,0)
game.Debris:AddItem(velo,0.1)
lastwall = hit
wait(.5)
lastwall = nil
end
end
end
end)