The extent of what I have done so far to unsuccessful results are as follows. ~~~~~~~~~~~~~~~~~ print("Script Load") -- Get the player's GUI and create a new ScreenGui as the viewmodel container local tool = game.StarterPack.M1 local playerGui = game.Players.LocalPlayer.PlayerGui local viewModelGui = Instance.new("ScreenGui") viewModelGui.Name = "ViewModelGui" viewModelGui.Enabled = false viewModelGui.Parent = playerGui print("Script GUI And Viewmodel")
-- Create a new Frame as the container for the viewmodel model local viewModelFrame = Instance.new("Frame") viewModelFrame.Name = "ViewModelFrame" viewModelFrame.Size = UDim2.new(1, 0, 1, 0) viewModelFrame.BackgroundTransparency = 1 viewModelFrame.Parent = viewModelGui print("Script GUI And ViewmodelFRAME")
local ViewmodelFunny = game.Workspace.VooModel ViewmodelFunny.Parent = viewModelFrame ViewmodelFunny:SetPrimaryPartCFrame(CFrame.new(Vector3.new(0, 0, 0))) -- adjust the position of the model as needed ViewmodelFunny.PrimaryPart.Anchored = true -- lock the position of the model to prevent it from moving with the camera print("ScriptCFRAME")
local cameraPart = ViewmodelFunny.CameraBone local humanoidRootPart = ViewmodelFunny.HumanoidRootPart print("Variables :D")
local camera = game.Workspace.CurrentCamera camera.CameraSubject = cameraPart camera.CameraType = Enum.CameraType.Scriptable camera.Parent = cameraPart camera.CFrame = CFrame.new(humanoidRootPart.Position + Vector3.new(0, 1, -3), humanoidRootPart.Position) print("CAMERA") print(script.Parent)
script.Parent.Equipped:Connect(function(on) print("Detected") viewModelGui.Enabled = true print("true") end)
-- Hide the viewmodel when the player unequips the tool script.Parent.Unequipped:Connect(function() print("Detected But negative") viewModelGui.Enabled = false print("False") end)
~~~~~~~~~~~~~~~~~