#Error code

1 messages · Page 1 of 1 (latest)

dim valley
#

I was finishing a part of the code and when I started the game it didn't give me the weapon I went to see the output and I see this but I don't know what the error could be

sick grove
#

i neeed the full script

dim valley
sick grove
#

coudl you copy and paste

dim valley
#

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local camera = game.Workspace.CurrentCamera

local aimCF = CFrame.new()

local isAiming = false

local currenSwayAMT = 1
local swayAMT = .1;
local aimSwayAMT = .1;
local swayCF = CFrame.new()
local lastCameraCF = CFrame.new()

local framework = {
inventory = {
"AK74";
"BERETTA";
"Knife";
"Frag";
};

module = nil;
viewmodel = nil;
currentSlot = 1;

}

function loadslot(Item)
local viewmodelFolder = game.ReplicatedStorage.ViewModels
local moduleFolder = game.ReplicatedStorage.Modules
for i,v in pairs(camera:GetChildren())do
if v:IsA("Model") then
v:Destroy()
end
end

if moduleFolder:FindFirstChild(Item) then
    framework.module = require(moduleFolder:FindFirstChild(Item))

    if viewmodelFolder:FindFirstChild(Item) then
        framework.viewmodel = viewmodelFolder:FindFirstChild(Item):Clone()
        framework.viewmodel.Parent = camera
    end
end

end

RunService.RenderStepped:Connect(function()

local rot = camera.CFrame:ToObjectSpace(lastCameraCF)
local X,Y,Z = rot:ToOrientation()
swayCF = swayCF:Lerp(CFrame.Angles(math.sin(X) * currenSwayAMT, math.sin(Y) * currenSwayAMT, 0), .1)
lastCameraCF = camera.CFrame

local humanoid = character:WaitForChild("Humanoid")
#

if humanoid then
local bobOffset = CFrame.new(humanoid.CameraOffset.X, humanoid.CameraOffset.Y, humanoid.CameraOffset.Z)

for i, v in pairs(camera:GetChildren()) do
    if v:IsA("Model") then
        v:SetPrimaryPartCFrame(camera.CFrame * swayCF * aimCF)
    end
end

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)
    currenSwayAMT = aimSwayAMT
else
    local offset = CFrame.new()
    aimCF = aimCF:Lerp(offset, framework.module.aimSmooth)
    currenSwayAMT = swayAMT
end

end

loadslot(framework.inventory[1])

UserInputService.InputBegan:Connect(function(input)

if input.KeyCode == Enum.KeyCode.One then
    if framework.currentSlot ~= 1 then
        loadslot(framework.inventory[1])
        framework.currentSlot = 1
    end
end

if input.KeyCode == Enum.KeyCode.Two then
    if framework.currentSlot ~= 2 then
        loadslot(framework.inventory[2])
        framework.currentSlot = 2
    end
end

if input.UserInputType == Enum.UserInputType.MouseButton2 then 
    isAiming = true
end

end)

UserInputService.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton2 then
isAiming = false
end
end)

gritty steeple
#

its end) not end on line 78

dim valley
#

more errors

sick grove
#

tell me if there are any error that i may have added as a mistake

calm coveBOT
#

studio** You are now Level 1! **studio

gritty steeple
#

omg it was just missing an end) at the bottom

sick grove
#

moving loadslot(framework.inventory[1]) outside of the RenderStepped connection and placing it before the InputBegan connection.

lone hound
#

ur missing an end for if humanoid then

sick grove
#

did it work

dim valley
#

its working thank you so much

sick grove
#

np

gritty steeple
dim valley
#

How did you find the error so quickly?

gritty steeple
sick grove
#

liek @gritty steeple said im him

dim valley
sick grove
#

for sure

#

now for the payment

#

jk

dim valley
gritty steeple
sick grove
#

no 5 trillion

gritty steeple
sick grove
#

oh ya 5 quintillion

gritty steeple
#

-# skipping the one below it

dim valley
#

I can give you a promissory note for the year 2325

sick grove
#

5 Octillion

#

NO

#

5 Nonillion

#

anyways gtg rn

gritty steeple
#

cya