DISCLAIMER: Code of Xeradev on YT!
I´m currently working on an FPS with the help of the tutorials of the YT Channel Xeradev. When I added sounds, I got an error. "Players.LumpiMagDich.PlayerScripts.Framework - Client:112: attempt to index nil with 'aimSmooth'". The lines I wrote, edited have nothing to do with the line the error gives me, wich I made days ago, and never had problems with. checked if i did something wrong, but there is nothing I found.already red it means that it is indefinined, but i dont know where my problem is.
if isAiming and framework.viewmodel ~=nil and framework.module.canAim then
local offset = framework.viewmodel.AimPart.CFrame:ToObjectSpace(framework.viewmodel.PrimaryPart.CFrame)
aimCF = aimCF:Lerp(offset, framework.module.aimSmooth)
currentSwayAMT = aimSwayAMT
else
local offset = CFrame.new()
aimCF = aimCF:Lerp(offset, framework.module.aimSmooth) <- this is the error line
currentSwayAMT = swayAMT
end
end)
how do i fix it? all i red under the video was to change from r6 to r15, which i did to my character, but i really dont know what to do. If the problem is rlly dum, i'm sorry, started with Lua only a week ago, so i need everything to help me. thanks the code I recently added:
if viewmodelFolder:FindFirstChild(Item) then
framework.viewmodel = viewmodelFolder:FindFirstChild(Item):Clone()
framework.viewmodel.Parent = camera
fireAnim = Instance.new("Animation")
fireAnim.Parent = framework.viewmodel
fireAnim.Name = "Fire"
fireAnim.AnimationId = framework.module.fireAnim
fireAnim = framework.viewmodel.AnimationController.Animator:LoadAnimation(fireAnim)
fireSound = Instance.new("Sound")
fireSound.Parent = character.UpperTorso
fireSound.Name = "Fire"
fireSound.SoundId = framework.module.fireSound.SoundId
end
and also
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if character and framework.viewmodel and framework.module then
fireAnim:Play()
character.UpperTorso.Fire:Play()
end
end
end)
if that is important
