I’m making a game called backrooms lost insanity; how can i attach a flashlight to the player’s hand? My game is not r15 and yes r6, but every time i try to attach something in the player’s hand, it just rotates in the wrong way. Can someone help me and give me some tips or something?
I mean, i’m making the flashlight like play an animation, but i don’t want it to be a tool, i want to attach to the player’s hand, a long time ago, this didn’t worked idk why (the game was called escape from wonderland and i was making a flare, i tried to do that but it didn’t work, it was super bugged, the orientation wasn’t good, and it was bugged)
So is the flashlight a part of the animation, or are you using some constraint/weld to attach it to the player’s hand, or etc? You may be able to tinker with the CFrame or orientation in the code or constraint that creates the attachment, right?
You can play with a dummy (preferably copy some random walking script (check toolbox) to test how it moves the arm/hand along with the flashlight) and use a constraint/weld to keep the flashlight stuck on their hand then experiment with the properties. Then, to apply this to code, you’d need to copy the position/orientation of the flashlight or the properties of the constraint/weld. This is one easy way I can think of.
local flashlight = game:GetService("ServerStorage").Flashlight -- wherever it is
local function doStuff(hand)
-- do your attachment stuff here w/ flashlight and hand
end
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local hand = character:WaitForChild("Right Arm")
doStuff(hand)
end)
end)
If you use a tool, make sure RequiresHandle is ticked in its properties. Then, place a part in the tool and call it “Handle”. This is what the character will hold out, and it should stay there. You can rotate/scale as needed.
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
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.
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