Motor6D not Cloning to Players Hands

I want to make a dumbell clone to the players hands and make it fit properly with Motor6D and its not cloning to the players Right Hand.

local BenchPressWeights = game.ServerStorage:WaitForChild("BasicBenchPressWeights")
local Prox = script.Parent

Prox.Triggered:Connect(function(player)
	local character = player.Character
	local humanoid = character:WaitForChild("Humanoid")

	local clone = BenchPressWeights:Clone()
	clone.Parent = character.RightHand

	character.RightHand:WaitForChild("RightGrip"):Destroy()
	local Motor6D = Instance.new("Motor6D", character.RightHand)
	Motor6D.Name = "BenchpressMotor6D"
	Motor6D.Part0 = character.RightHand
	Motor6D.Part1 = BenchPressWeights.Handle
	Motor6D.C0 = CFrame.new(-1.6, 0, 0.03)
end)

Outcome:

1 Like

For the dumbbell replica to align correctly with Motor6D and connect properly to the players RightHand it’s essential to make tweaks and follow recommended methods, in your script:


local BenchPressWeights = game.ServerStorage:WaitForChild(“BasicBenchPressWeights”)
local Prox = script.Parent

Prox.Triggered:Connect(function(player)
local character = player.Character
if not character then
return
end

local humanoid = character:WaitForChild("Humanoid")
local rightHand = character:FindFirstChild("RightHand")

if not rightHand then
    return
end

-- Clone the dumbbell and position it in the right hand
local clone = BenchPressWeights:Clone()
clone.Parent = rightHand

-- Remove existing RightGrip and create a new Motor6D for proper positioning
local rightGrip = rightHand:FindFirstChild("RightGrip")
if rightGrip then
    rightGrip:Destroy()
end

local Motor6D = Instance.new("Motor6D", rightHand)
Motor6D.Name = "BenchpressMotor6D"
Motor6D.Part0 = rightHand
Motor6D.Part1 = clone.Handle
Motor6D.C0 = CFrame.new(-1.6, 0, 0.03)  -- Adjust this position as needed

end)

2 Likes

I couldn’t paste the entire script earlier, so please double check it when copying. Apologies for any inconvenience! :pray:

1 Like

Im using a seat for this and i have 2 scripts inside of the ProximityPrompt, this script and another one for the player to be able to use a ProxPrompt to sit. How could i make it so the Weights deletes once the player leaves the seat? this may be a bit tricky to get done

1 Like

image

1 Like

To ensure weights are removed when the player leaves the seat:

  1. Store the current player occupying the seat.
  2. When the player exits, check and remove the weights accordingly.
    This keeps your game clean and responsive to player interactions.
1 Like
local Prox = script.Parent
local Seat = Prox.Parent

local function HandleOccupancyChange()
	Prox.Enabled = not Seat.Occupant
end

Seat:GetPropertyChangedSignal("Occupant"):Connect(HandleOccupancyChange)

local function HandleProximityTrigger(player)
	if player.Character and player.Character.Humanoid then
		Seat:Sit(player.Character.Humanoid)
	end
end

Prox.Triggered:Connect(HandleProximityTrigger)

this is my script for the ProxToSit

1 Like

The provided script manages interaction with a seat using a ProximityPrompt. It ensures the ProximityPrompt is enabled or disabled based on whether the seat is occupied (Seat.Occupant). When a player triggers the ProximityPrompt, the script checks if the player has a character (Character) with a Humanoid, and if so, it makes the character sit in the seat (Seat:Sit(player.Character.Humanoid)). This allows smooth and effective interaction with the seat in the game.
( So the script is well structured and designed )

1 Like