You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
So what I’m trying to do is get the gun shown on the player screen -
What is the issue? Include screenshots / videos if possible!
As you can see the gun is not on the screen. And I’m trying to figure out why
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Yes, I was literally following an tutorial on how to make one.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- ---//Replace this with a loading screen
repeat
wait()
until game:IsLoaded()
---//Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
---//ModuleScripts
local CameraModule = require(ReplicatedStorage.Modules.ModuleScripts.CameraModule)
local GunModules = ReplicatedStorage.Modules:WaitForChild("GunModules")
local GunModels = ReplicatedStorage:WaitForChild("GunModels")
---//Client Variables
local CurrentCamera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Mouse = Player:GetMouse()
---//CFrame Variable
local MainCF = CFrame.new()
Player.CameraMode = Enum.CameraMode.LockFirstPerson
---//Weapon Variables
local Primary = "M1911"
local Secondary = ""
local WeaponInHand
local WeaponData
function setup(Weapon)
local WeaponModule = require(GunModules:WaitForChild(Weapon))
MainCF = WeaponModule.MainCFrame
WeaponInHand = GunModels:WaitForChild(Weapon):Clone()
WeaponInHand.PrimaryPart = WeaponInHand:WaitForChild("Handle")
print(WeaponInHand.PrimaryPart)
WeaponInHand.Parent = CurrentCamera
end
setup(Primary)
RunService.RenderStepped:Connect(function()
if WeaponInHand then
WeaponInHand:SetPrimaryPartCFrame(
CurrentCamera.CFrame * MainCF
)
end
end)