Make this flashlight more Realistic

What do you want to achieve? Keep it simple and clear!
I simply want this flashlight to have a more realistic appearance. How can I add a flashlight tool in my hand? the flashlight performs similarly to what the video did.

  1. What is the issue? Include screenshots / videos if possible!
    Actually, I don’t think there is a problem. I simply lack the necessary skills. I tried adding a flashlight tool, but I want it to be more stable because it is swaying.

  2. What solutions have you tried so far?
    Everything actually. If there is no solution, I will stick with what I now have.

Here’s the flashlight I got
https://gyazo.com/4358f810c987935ed7c4b5acce17353d

This is what I mean by Flashlight In Hand
https://medal.tv/games/roblox/clips/8b7Xb8LL7Kg5W/3DoOFt6FUSIU?invite=cr-MSxKekksNjkwMDYwOTQs

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

2 Likes

Could you please provide the script for the flashlight? We cannot debug it or make improvements upon it without being able to see it.

1 Like

Please fix the formatting of the code.

```lua 
Your code here
Then you close it with the ```, but without the lua part.
1 Like

Put the flashlight in the player’s Camera, then use the same code that you used in the camera swaying for the flashlight.

3 Likes

How exactly can I put the tool in the Player’s Camera? Can you give me a sample code

1 Like

Viewmodel Script + Sway
Put in StarterCharacterScripts

local player = game.Players.LocalPlayer
local char = player.Character
local cam = workspace.CurrentCamera
local viewmodel = game.ReplicatedStorage:WaitForChild("viewmodel"):Clone() or game.ReplicatedStorage.viewmodel:Clone() -- just incase it's already loaded
local run = game:GetService("RunService")
local CameraCF = CFrame.new()
local swayCF = CFrame.new()
local SwayX = 2
local SwayY = 2
run.RenderStepped:Connect(function()
	local rotation = workspace.CurrentCamera.CFrame:toObjectSpace(CameraCF)
	local x,y,z = rotation:ToOrientation()
	swayCF = swayCF:Lerp(CFrame.new(math.sin(-y)*SwayX,math.sin(x)*SwayY,0), .2)
	CameraCF = cam.CFrame
	viewmodel:SetPrimaryPartCFrame(cam.CFrame * CFrame.new(0,-1,0)*swayCF)
end)

viewmodel.Parent = cam

viewmodel

(Sorry I wasn’t able to explain it, im not very good with explaining)

2 Likes

Thanks dude! you really helped a ton :slight_smile:

No Problem! Glad I could help!