-
What do you want to achieve? Keep it simple and clear!
I wanna make rope’s winch pull my player character to anchored parts -
What is the issue?
It works with unanchored parts, pulls both sides to each other, but doesn’t do anything with anchored parts
-
What solutions have you tried so far?
Tried tweaking some lines where welds’ Part1 property is being changed, but it didn’t do much.
Also wanna mention all of this
Cloning Model from ServerStorage to character, but script that makes my model work is local, that’s an issue I can’t remote-event yet (idk how to)
Script itself:
local ODM = game.Players.LocalPlayer.Character.ODM
local UserInputService = game:GetService('UserInputService')
UserInputService.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.Q then
local mouseLocation1 = UserInputService:GetMouseLocation()
local screenToWorldRay1 = workspace.CurrentCamera:ViewportPointToRay(mouseLocation1.X, mouseLocation1.Y)
local directionVector1 = screenToWorldRay1.Direction * 10000
local raycastResult1 = workspace:Raycast(screenToWorldRay1.Origin, directionVector1)
ODM.LeftPart.LeftWeld.Part1 = raycastResult1.Instance
ODM.LeftPart.Position = raycastResult1.Position
end
if key.KeyCode == Enum.KeyCode.E then
local mouseLocation2 = UserInputService:GetMouseLocation()
local screenToWorldRay2 = workspace.CurrentCamera:ViewportPointToRay(mouseLocation2.X, mouseLocation2.Y)
local directionVector2 = screenToWorldRay2.Direction * 10000
local raycastResult2 = workspace:Raycast(screenToWorldRay2.Origin, directionVector2)
ODM.RightPart.RightWeld.Part1 = raycastResult2.Instance
ODM.RightPart.Position = raycastResult2.Position
end
end)
UserInputService.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.Q then
ODM.LeftPart.LeftWeld.Part1 = ODM.HRPart
ODM.LeftPart.Position = game.Players.LocalPlayer.Character.HumanoidRootPart.Position
end
if key.KeyCode == Enum.KeyCode.E then
ODM.RightPart.RightWeld.Part1 = ODM.HRPart
ODM.RightPart.Position = game.Players.LocalPlayer.Character.HumanoidRootPart.Position
end
end)