Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Could someone help me with "The First Person Element Of A First Person Shooter" blog?

Asked by 5 years ago
Edited 5 years ago

So I am trying to make an FPS game using "The First Person Element Of A First Person Shooter" blog, but I am having trouble on the first step of making the gun appear in front of the camera.

--LocalScript in StarterPack

local Players = game:GetService("Players")
local player = Players.LocalPlayer

local rsStorage = game:GetService("ReplicatedStorage")

local camera = game.Workspace.CurrentCamera
local humanoid = player.CharacterAdded:Wait():WaitForChild("Humanoid")

local viewModel = rsStorage:WaitForChild("viewModel"):Clone()

local function onDied()
    viewModel.Parent = nil
end

local function onUpdate(dt)
    viewModel.Head.CFrame = camera.CFrame
    print("hi")
end

humanoid.Died:Connect(onDied)
game:GetService("RunService").RenderStepped:Connect(onUpdate)

local repWeapon = rsStorage:WaitForChild("FAMAS")
local weapon = repWeapon:Clone()

weapon.Parent = viewModel
viewModel.Parent = camera

local joint = Instance.new("Motor6D")
joint.C0 = CFrame.new(1, 1, 1)
joint.Part0 = viewModel.Head
joint.Part1 = weapon.Handle
joint.Parent = viewModel.Head
print("Done")

It prints "Done" and keeps printing "hi". There are no errors in the output. Also, sorry that the script is kind of long. Another thing is that I can see the viewModel and the FAMAS in random positions in the workspace.

1 answer

Log in to vote
-5
Answered by 5 years ago
Edited 5 years ago

Put the camera max zoom distance value to as low as it goes, start making the player shoot and win!

I understand your frustration in getting to work a semi-auto hand pistol shooter. Tough hurdles are going to come your way and now you can do something:

Yes I did read it and it seems you're trying to make your guns go in front of your camera in 1st Person perspective and make it greet you or something along the lines of realistic interactive communication with an object such as a Desert Eagle.

I'm your friend believe it, or not and I'm working by your side every step of the journey...

0
Did you even read it... Endergenius100 12 — 5y
0
Screenshot what it looks like when youf are in First-Person mode ASAP... Jan14th2019 -53 — 5y
Ad

Answer this question