I need to make it so that it will only work if it has a specific 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 * 3 ) 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)
If you're using raycasting, then it should be pretty easy
if(hit.Name == "Whatever name is required") then --do the thing end
So if I was doing this with a lot of parts, and needed one of the same name, I would do something like this.
for i,v in pairs(parts parent:GetChildren()) do if v.Name == "PartName" then -- yes end end
If you wanted to do anything with the part, use v instead of the route.