You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want a grappling hook that you can like climb with. -
What is the issue? Include screenshots / videos if possible!
The past rope constraint wont get destroyed. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried iterating through the character and deleting the constraint.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(Player, Mouse)
local Char = Player.Character or Player.CharacterAdded:Wait()
local HRP = Char:WaitForChild("HumanoidRootPart")
for i, v in pairs(Char:GetDescendants()) do
if v:IsA("RopeConstraint") and v:IsA("Attachment") then
v:Destroy()
end
end
local Debris = game:GetService("Debris")
local RayCastParams = RaycastParams.new()
local RayCastFilterType = Enum.RaycastFilterType.Blacklist
RayCastParams.FilterDescendantsInstances = {Char}
local Start = Char:WaitForChild("RightHand")
local Origin = Start.Position
local Direction = Mouse.lookVector * 2000
local RayCastResult = game.Workspace:Raycast(Origin, Direction, RayCastParams)
local TweenService = game:GetService("TweenService")
if RayCastResult then
HRP.CanCollide = false
local Part = RayCastResult.Instance
print(Part:GetFullName())
local Rope = Instance.new("RopeConstraint")
local Att0, Att1 = Instance.new("Attachment"), Instance.new("Attachment")
local info = {
Length = 0
}
local tweeninfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0)
local Tween = TweenService:Create(Rope, tweeninfo, info)
Debris:AddItem(Att0, 5)
Debris:AddItem(Att1, 5)
Debris:AddItem(Rope, 5)
Att0.Parent = Start
Att1.Parent = Part
Att0.WorldPosition = Origin
Att1.WorldPosition = Mouse.p
Rope.Parent = Start
Rope.Attachment0 = Att0
Rope.Attachment1 = Att1
Rope.Length = (Att1.WorldPosition - Att0.WorldPosition).Magnitude + 10
Rope.Visible = true
Tween:Play()
end
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.