Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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?

2 comments

1

try to return s instead of true, which is the boolean value

0

Thank you so much! It worked!

1 answer

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.