Does anyone know how to create a weapon inspect viewport?

I’m trying to achieve a working weapon inspect viewport. My issues are the viewport has terrible positioning and just doesn’t even want to work. So far I tried setting the model’s cframe to the mouse but still isn’t working. Any idea why?

local mouse = game:GetService("Players").LocalPlayer:GetMouse()

local tweenService = game:GetService("TweenService")
local userinputservice = game:GetService("UserInputService")

local x = false

userinputservice.InputBegan:Connect(function(input, gpe)
	if gpe then return end
	
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		x = true
	end
end)

userinputservice.InputEnded:Connect(function(input, gpe)
	if gpe then return end
	
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		x = false
	end
end)

game["Run Service"].RenderStepped:Connect(function()
	if x == true then
		script.Parent.ViewportFrame["Raging bull gun"].CFrame.Rotation = CFrame.new(-mouse.Hit.Position.X, mouse.Hit.Position.Y, mouse.Hit.Position.Z)
	end
end)
1 Like

There is a youtube video for it ROBLOX Tutorials I How to Make a Character Display (GUI) - YouTube
Its for a roblox character, you could change it up a bit

Thanks changed the code in like 5 minutes and made it work. Thanks man.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.