-
What do you want to achieve? Keep it simple and clear!
Im trying to make a system where you place ropes on the edges of walls, and the whole rope being out of the wall and not half of it being in the wall
The system is already done but the only problem is half of the rope being in the wall
-
What is the issue? Include screenshots / videos if possible!
This is what it looks like right now:
And this is what i want it to look like:
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I already tried to move the rope 0.5 studs forward with Vector3 from what the raycast result is but that is not good because that would only work for 2 sides and the rope would be completly in the wall for the 2 others sides, aswell as not working if a side is diagonal
I have no idea on how to make the rope be fully outside the wall its placed on, no matter what side you are on
Here is my script:
local Debris = game:GetService("Debris")
local placingrope = false
script.Parent.Activated:Connect(function()
local character = script.Parent.Parent
local hrp = character:FindFirstChild("HumanoidRootPart")
if placingrope == false then
local RayStart = hrp.Position + hrp.CFrame.LookVector * 5
local RayDirection = -hrp.CFrame.UpVector*1
local RayResult = workspace:Raycast(RayStart, RayDirection * 50)
if RayResult == nil then return end -- if ground is below 50 studs or inexistant
local Distance = (RayStart - RayResult.Position).magnitude
if RayResult and character.Humanoid.FloorMaterial ~= Enum.Material.Air then
local RayStart = (hrp.Position + hrp.CFrame.LookVector * 5) - Vector3.new(0, 3, 0)
local RayDirection = -hrp.CFrame.LookVector
local RayResult = workspace:Raycast(RayStart, RayDirection * 10)
if RayResult == nil then return end
print(RayResult)
if Distance >= 5 then
local nomovement = Instance.new("BodyVelocity")
nomovement.MaxForce = Vector3.new(1,0,1) * 100000
nomovement.Name = "TrueStunBV"
nomovement.Parent = character.HumanoidRootPart
character.Humanoid.AutoRotate = false
placingrope = true
local currentropenumber = 1
while placingrope == true do
local ropepart = game.ServerStorage.Assets.RopePart:Clone()
ropepart.Position = (RayResult.Position - Vector3.new(0, currentropenumber, 0))
ropepart.Parent = workspace
currentropenumber += 1
wait(0.2)
end
nomovement:Destroy()
character.Humanoid.AutoRotate = true
end
end
else
placingrope = false
end
end)
script.Parent.Unequipped:Connect(function()
if placingrope == true then
placingrope = false
end
end)
Any help would be greatly appreciated, thanks.