Hello! Thank you for visiting this forum.
I’ll get straight to the point. I was working on a flashlight system that, when the player presses ‘F’, a flashlight model is placed on the UpperTorso.
My issue is that it doesn’t position correctly, as shown in the following image:
This is how I would like my flashlight to appear:
I’ve noticed that this problem can be solved by manipulating Vector3 or CFrame, but my attempts to implement this have failed. I would appreciate it if you could provide a line of code in the following script (located in StarterCharacterScripts) that correctly positions the flashlight as I’ve explained in the previous image. You don’t need to position the flashlight yourselves; I just want to know how to change its position. I might also need to adjust its rotation. My main challenge is that the flashlight is divided into different parts as a model, and I want to adjust the position of the entire model. Thank you for your assistance!
This is the script:
script.VisualizeFlashlight.OnServerEvent:Connect(function()
game.Lighting.Flash:Clone().Parent = script.Parent
script.Parent:WaitForChild("Flash").Handle.Sound:Play()
local weld = game.Lighting.Weld:Clone()
weld.Parent = script.Parent
weld.Part0 = script.Parent.UpperTorso
weld.Part1 = script.Parent:WaitForChild("Flash").Handle
-- I want here the code line i think.
end)
This is the FlashLightModel (Inside Lighting):