Thanks, but as i said in my post, i’m not making a tool, i’m trying to attach a part to the player’s hand
oops - I missed that line
But why not use a tool? Do you want it to be interactable? If it’s a torch/flashlight, why not?
Like @colorblindcrayon said, welds are the way to go.
I don’t want to make a tool, i want to make just a simple flashlight that shows, because one of my scripts already show the arms and i don’t want a tool, because i want to make it so you can pick multiple things while having the flashlight equipped
You could use alignposition and alignorientation with an attachment inside of the players hand and then that way its not a tool and itll be able to follow the players hand position and keep its own orientation
This would also allow for automatic replication aswell, since those are replicated to all clients
just a question, what is a alignposition and alignorientation???
Basically they are constraints the like the name says allows you to position things and orient things using attachments
Thanks, i might use that or not, thanks for the suggestion tho
@colorblindcrayon It didn’t work buddy, It teleports to a completely other cframe, not on the grip one, how can i fix that?
here’s the code:
local hand = Character:WaitForChild("Right Arm")
flashlightmeshclone.Parent = Character
FlashlightMeshConnection = RunService.RenderStepped:Connect(function()
flashlightmeshclone.CFrame = hand.RightGripAttachment.CFrame
end)
FlashlightAnimation:Play()
I don’t normally touch the RightGripAttachment but if it teleports to a completely other CFrame that probably means you’re using the wrong attachment?
I’ll suggest a different way. Use “WeldConstraint”, they both take in a Part0 and Part1 property. It doesn’t matter what order you do it in, just put one as the arm/hand and the other as the flashlight. Set the CFrame of the flashlight exactly how you’d want it to be and then have the constraints (the “WeldConstraint”) parented to the hand/arm. What this does is “lock” the position and orientation to the hand/arm. When the hand/arm moves, the flashlight moves at the same time which is the attachment part.
If you don’t know how to use those, look for tutorials and resources. If your flashlight is a model or multiple parts, you may need to create a “WeldConstraint” for each part in it.
This wouldn’t be a great way to do this … you would most likely be better off simply setting up a weld constraint. You could put everything in place so it is working as you wish with the weld inside the part. Then when you want it to be part of where you’re welding it too, just enable the weld.
Ok guys, thanks for all the helps, i’m gonna try some of them.
Why not create a Weld and change it’s C0 to rotate and stay in the way you want?
local weld = Instance.new("Weld")
weld.Part0 = Flashlight.PrimaryPart
weld.Part1 = Character.Hand
weld.C0 = CFrame.fromOrientation(0,0,0)
i don’t think this will work, because i don’t want to attach the flashlight to the player’s arm, i want to attach to the player’s attachment right grip
i tried and tried, for some reason, i want it to go to the attachment, but how can i do that? if i do ON the right arm, it will bug and… you know what will happen
There are different welders. I’m talking about the kind you add to your bar with a addon. You can weld about anything together using them.
Oh, so you’re talking about R6.
In that case, do what I’ve written but put the weld’s C1 as the right grip attachment’s CFrame.
local weld = Instance.new("Weld")
weld.Part0 = Flashlight.PrimaryPart
weld.Part1 = Character.RightArm
weld.C1= Character.RightArm.RightGripAttachment.CFrame
Haven’t tested it, but it should work.
It didn’t work, here’s the code:
FlashlightMeshClone.Parent = workspace
local weld = Instance.new("Weld")
weld.Part0 = FlashlightMeshClone
weld.Part1 = Character:FindFirstChild("Right Arm")
weld.C1= Character:FindFirstChild("Right Arm").RightGripAttachment.CFrame
FlashlightAnimation:Play()
why is it not working AAAAAAAAAAAAAAAA
--local script
local rst = game:GetService("ReplicatedStorage")
local flashlight = rst:WaitForChild("Flashlight")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local rightHandAttachment = character:WaitForChild("RightHand")
flashlight.CFrame = rightHandAttachment.CFrame * CFrame.new(0, 0, 0.1)
flashlight.Parent = rightHandAttachment
local weldConstraint = Instance.new("WeldConstraint")
weldConstraint.Parent = flashlight
weldConstraint.Part0 = flashlight
weldConstraint.Part1 = rightHandAttachment
Have to mess with this command for correct placement: CFrame.new(0, 0, 0.1)
ehhh, i give up always has to be that limit word
Programmers don’t give up, they just lose sleep.
This works, put this script in StarterPlayer.StarterPlayerScripts or StarterGui as a local script.
Then put your flashlight in ReplicatedStorage. This line here can move it to where you want it to be in the hand: CFrame.new(0, 0, 0.1) ← but you’ll have to try a few times to see what works for you.