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

attempt to index upvalue 'setting' (a boolean value), what is this error about?

Asked by 5 years ago
Edited 5 years ago

I have this script right here thats is located in a ModuleScript:

s = {
    weaponpPosition = CFrame.new(0.2,-1.4,0.6);
}
return true

And this one is Framework for the gun view model and its located in StarterCharacterScripts as a LocalScript:

local player = game.Players.LocalPlayer
local run = game:GetService("RunService")
local cam = workspace.CurrentCamera

local gun = game.ReplicatedStorage.Weapons.Deagle:Clone()

gun:SetPrimaryPartCFrame(cam.CFrame)

local setting = require(game.ReplicatedStorage.WeaponModules.Deagle)

run.RenderStepped:connect(function()
    gun:SetPrimaryPartCFrame(cam.CFrame * CFrame.new(setting.weaponpos)) --The Error
end)

gun.Parent = cam

local idle = gun.Humanoid:LoadAnimation(game.ReplicatedStorage.WeaponModules.Deagle.Animations.Idle)

idle:Play()

However whenever I try to run the game, the arms with the gun view model wont work, it gets stuck in the workspace midair. And I get this error saying Workspace.RoiGipot.Framework:12: attempt to index upvalue 'setting' (a boolean value)

It should be on my screen, rotating and moving with me. But its like a model in Workspace, and its in Camera.

Why I get this error?

1
try to return s instead of true, which is the boolean value the8bitdude11 358 — 5y
0
Thank you so much! It worked! HeyItzDanniee 252 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

I'm not 100% sure this is correct, but on line 12 shouldn't it be gun:SetPrimaryPartCFrame() instead of gun"DOT"SetPrimaryPartCFrame()?

Tell me if I'm wrong cause I'll take the answer down immediately lmao

EDIT:

I think the error may be that you didn't require the module script? I'm not very good with that kind of script so I'm not sure how they work to be honest. The only reason that I can think it would be a nil value is because you didn't set it.

Ad

Answer this question