Now the thing is I have already completed the first part by firing a raycast.
local WallRay = Ray.new(HRP.Position, HRP.CFrame.LookVector * 2)
local Wall, HPS, Normal, Material = workspace:FindPartOnRay(WallRay, Character)
if Wall and Wall:GetAttribute("Wall") then
HandAnim:Play()
end
The issue here is that the hand animation keeps playing even after you’re not facing the wall, and I am very confused on how I would detect if the player is not facing a wall anymore. If anybody can help me with this it would be greatly appreciated.
Once the player faces a wall, store it in a variable and create a loop to fire a ray. Check if the part the ray hits is the wall, if it is not the wall/hits nothing, then the player is no longer facing the wall.