Following a youtube tutorial on how to make a view model appear on your screen, i tried slightly modifying the script so that the view model would only appear when I have a tool equipped but to no avail. here is the script so far. the script is a local script lcoated in Startercharacterscripts.
local Player = game.Players.LocalPlayer
local Character = script.Parent
local Humanoid = Character.Humanoid
local HRP = Character.HumanoidRootPart
local Camera = workspace.CurrentCamera
local tool = Player.Backpack.M4A1
local UIS = game:GetService("UserInputService")
local RS = game:GetService("RunService")
local GuiService = game:GetService("GuiService")
local TS = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SpringModule = require(ReplicatedStorage.SpringModule)
local Viewmodel = game.ReplicatedStorage.ViewModels.M4A1.M4A1:Clone()
Viewmodel.Parent = Camera
tool.Equipped:BindToRenderStep("Viewmodel", 301, function(DT)
Viewmodel:PivotTo (
Camera.CFrame
)
end)