Problems with odm-like system (Constraints mostly)

  1. What do you want to achieve? Keep it simple and clear!
    I wanna make rope’s winch pull my player character to anchored parts

  2. What is the issue?
    It works with unanchored parts, pulls both sides to each other, but doesn’t do anything with anchored parts

  3. 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
studio

studio1

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)
1 Like

Okayyy, nevermind, I fixed it with remote event

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.