Attempt to index boolean with Value error

Hello im new to scripting but i need some help with this.RobloxStudioBeta_Fbjfgklwfj

Error

ServerScriptService.CodeGiver:6: attempt to index boolean with 'Value'

Inside my UI

local player = game.Players.LocalPlayer

local gui = script.Parent.CodeUi

local codevalue = player.CodeValues.CodeValue1.Value

local TypeCode = gui.InputCode

local ConfirmCode = gui.SubmitButton

local Code1 = "New"

ConfirmCode.MouseButton1Click:Connect(function()
    if TypeCode.Text == Code1 and codevalue == false then
        game.ReplicatedStorage.Codes.NewCode:FireServer(player)
        script.Parent.CodeUi.SubmitButton.Text = "Code Redeemded"
        wait(1.5)
        script.Parent.CodeUi.SubmitButton.Text = "Submit"
        
        end
end)

ConfirmCode.MouseButton1Click:Connect(function()
    if TypeCode.Text == Code1 and codevalue == true then
        gui.SubmitButton.Text = "Already Redeemded"
        wait(1.5)
        gui.SubmitButton.Text = "Submit"
    end
end)

OnServerEvent

game.ReplicatedStorage.Codes.NewCode.OnServerEvent:Connect(function(player)
	if player then
		do
			local players = game:GetService("Players")
			local codevalue = player.CodeValues.CodeValue1.Value
			codevalue.Value = true
			players[player.Name].leaderstats.Bucks.Value += 5000
		end
	end
end)

When you defined codevalue, you defined it as the value’s current state (true or false), not the actual object. That’s what caused the error when you attempted to change its value.

you’re assigning codevalue to a value not an instance

Thanks I See it Now i Appreciate the help!